mercurial/upgrade_utils/engine.py
changeset 46526 67b5fafd3a46
parent 46525 636853347e14
child 46780 6266d19556ad
--- a/mercurial/upgrade_utils/engine.py	Mon Feb 15 15:13:20 2021 +0530
+++ b/mercurial/upgrade_utils/engine.py	Wed Feb 10 17:08:34 2021 +0530
@@ -476,6 +476,27 @@
                 tr, unfi.manifestlog._rootstore._revlog, force=True
             )
         scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
+    elif (
+        len(upgrade_op.removed_actions) == 1
+        and [
+            x
+            for x in upgrade_op.removed_actions
+            if x.name == b'persistent-nodemap'
+        ]
+        and not upgrade_op.upgrade_actions
+    ):
+        ui.status(
+            _(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
+            nodemap.delete_nodemap(
+                tr, srcrepo, unfi.manifestlog._rootstore._revlog
+            )
+        scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
     else:
         with dstrepo.transaction(b'upgrade') as tr:
             _clonerevlogs(