mercurial/upgrade.py
changeset 42830 cf2b765cecd7
parent 42693 0812d9fb63fe
child 42831 908ff446590e
--- a/mercurial/upgrade.py	Fri Aug 30 18:11:41 2019 +0200
+++ b/mercurial/upgrade.py	Tue Jul 30 00:35:52 2019 +0200
@@ -864,13 +864,31 @@
 
     return backuppath
 
-def upgraderepo(ui, repo, run=False, optimize=None, backup=True):
+def upgraderepo(ui, repo, run=False, optimize=None, backup=True,
+                manifest=None):
     """Upgrade a repository in place."""
     if optimize is None:
         optimize = []
     optimize = set(legacy_opts_map.get(o, o) for o in optimize)
     repo = repo.unfiltered()
 
+    revlogs = set(UPGRADE_ALL_REVLOGS)
+    specentries = (('m', manifest),)
+    specified = [(y, x) for (y, x) in specentries if x is not None]
+    if specified:
+        # we have some limitation on revlogs to be recloned
+        if any(x for y, x in specified):
+            revlogs = set()
+            for r, enabled in specified:
+                if enabled:
+                    if r == 'm':
+                        revlogs.add(UPGRADE_MANIFEST)
+        else:
+            # none are enabled
+            for r, __ in specified:
+                if r == 'm':
+                    revlogs.discard(UPGRADE_MANIFEST)
+
     # Ensure the repository can be upgraded.
     missingreqs = requiredsourcerequirements(repo) - repo.requirements
     if missingreqs:
@@ -1020,7 +1038,7 @@
 
             with dstrepo.wlock(), dstrepo.lock():
                 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs,
-                                          upgradeactions)
+                                          upgradeactions, revlogs=revlogs)
             if not (backup or backuppath is None):
                 ui.write(_('removing old repository content%s\n') % backuppath)
                 repo.vfs.rmtree(backuppath, forcibly=True)