Read about our upcoming Code of Conduct on this issue

Commit d0a566af authored by Pulkit Goyal's avatar Pulkit Goyal
Browse files

upgrade: speed up when we have only nodemap to downgrade

The test change is wrong.
parent a95041f633fa
Pipeline #17931 passed with stages
in 33 minutes and 31 seconds
......@@ -128,6 +128,14 @@ def update_persistent_nodemap(revlog):
def delete_nodemap(tr, repo, revlog):
""" Delete nodemap data on disk for a given revlog"""
if revlog.nodemap_file is None:
msg = "calling persist nodemap on a revlog without the feature enabled"
raise error.ProgrammingError(msg)
def persist_nodemap(tr, revlog, pending=False, force=False):
"""Write nodemap data on disk for a given revlog"""
if getattr(revlog, 'filteredrevs', ()):
......@@ -476,6 +476,27 @@ def upgrade(ui, srcrepo, dstrepo, upgrade_op):
tr, unfi.manifestlog._rootstore._revlog, force=True
scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
elif (
len(upgrade_op.removed_actions) == 1
and [
for x in upgrade_op.removed_actions
if == b'persistent-nodemap'
and not upgrade_op.upgrade_actions
_(b'downgrading repository to not use persistent nodemap feature\n')
with srcrepo.transaction(b'upgrade') as tr:
unfi = srcrepo.unfiltered()
cl = unfi.changelog
nodemap.delete_nodemap(tr, srcrepo, cl)
# check comment 20 lines above for accessing private attributes
tr, srcrepo, unfi.manifestlog._rootstore._revlog
scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
with dstrepo.transaction(b'upgrade') as tr:
......@@ -581,7 +581,7 @@ downgrading
plain-cl-delta: yes yes yes
compression: zlib zlib zlib
compression-level: default default default
$ hg debugupgraderepo --run --no-backup --quiet
$ hg debugupgraderepo --run --no-backup
upgrade will perform the following actions:
......@@ -593,8 +593,17 @@ downgrading
- changelog
- manifest
beginning upgrade...
repository locked and read-only
creating temporary repository to stage upgraded data: $TESTTMP/test-repo/.hg/upgrade.* (glob)
(it is safe to interrupt this process any time before data migration completes)
downgrading repository to not use persistent nodemap feature
removing temporary repository $TESTTMP/test-repo/.hg/upgrade.* (glob)
$ ls -1 .hg/store/ | egrep '00(changelog|manifest)(\.n|-.*\.nd)'
00changelog-*.nd (glob)
00manifest-*.nd (glob)
$ hg debugnodemap --metadata
......@@ -643,6 +652,8 @@ upgrading
00manifest-*.nd (glob)
$ hg debugnodemap --metadata
uid: * (glob)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment