mercurial/upgrade.py
changeset 41088 5608b5a6c323
parent 40997 038108a9811c
child 41089 a59a74721c76
--- a/mercurial/upgrade.py	Fri Dec 21 05:27:30 2018 +0100
+++ b/mercurial/upgrade.py	Fri Jul 13 03:05:30 2018 +0200
@@ -348,6 +348,19 @@
 
     return deficiencies
 
+# search without '-' to support older form on newer client.
+#
+# We don't enforce backward compatibility for debug command so this
+# might eventually be dropped. However, having to use two different
+# forms in script when comparing result is anoying enough to add
+# backward compatibility for a while.
+legacy_opts_map = {
+    'redeltaparent': 're-delta-parent',
+    'redeltamultibase': 're-delta-multibase',
+    'redeltaall': 're-delta-all',
+    'redeltafulladd': 're-delta-fulladd',
+}
+
 def findoptimizations(repo):
     """Determine optimisation that could be used during upgrade"""
     # These are unconditionally added. There is logic later that figures out
@@ -355,7 +368,7 @@
     optimizations = []
 
     optimizations.append(improvement(
-        name='redeltaparent',
+        name='re-delta-parent',
         type=optimisation,
         description=_('deltas within internal storage will be recalculated to '
                       'choose an optimal base revision where this was not '
@@ -368,7 +381,7 @@
                          'base revision if needed')))
 
     optimizations.append(improvement(
-        name='redeltamultibase',
+        name='re-delta-multibase',
         type=optimisation,
         description=_('deltas within internal storage will be recalculated '
                       'against multiple base revision and the smallest '
@@ -385,7 +398,7 @@
                          'significantly')))
 
     optimizations.append(improvement(
-        name='redeltaall',
+        name='re-delta-all',
         type=optimisation,
         description=_('deltas within internal storage will always be '
                       'recalculated without reusing prior deltas; this will '
@@ -396,12 +409,12 @@
                          'execution time')))
 
     optimizations.append(improvement(
-        name='redeltafulladd',
+        name='re-delta-fulladd',
         type=optimisation,
         description=_('every revision will be re-added as if it was new '
                       'content. It will go through the full storage '
                       'mechanism giving extensions a chance to process it '
-                      '(eg. lfs). This is similar to "redeltaall" but even '
+                      '(eg. lfs). This is similar to "re-delta-all" but even '
                       'slower since more logic is involved.'),
         upgrademessage=_('each revision will be added as new content to the '
                          'internal storage; this will likely drastically slow '
@@ -654,20 +667,20 @@
     ui.write(_('(it is safe to interrupt this process any time before '
                'data migration completes)\n'))
 
-    if 'redeltaall' in actions:
+    if 're-delta-all' in actions:
         deltareuse = revlog.revlog.DELTAREUSENEVER
-    elif 'redeltaparent' in actions:
+    elif 're-delta-parent' in actions:
         deltareuse = revlog.revlog.DELTAREUSESAMEREVS
-    elif 'redeltamultibase' in actions:
+    elif 're-delta-multibase' in actions:
         deltareuse = revlog.revlog.DELTAREUSESAMEREVS
-    elif 'redeltafulladd' in actions:
+    elif 're-delta-fulladd' in actions:
         deltareuse = revlog.revlog.DELTAREUSEFULLADD
     else:
         deltareuse = revlog.revlog.DELTAREUSEALWAYS
 
     with dstrepo.transaction('upgrade') as tr:
         _copyrevlogs(ui, srcrepo, dstrepo, tr, deltareuse,
-                     'redeltamultibase' in actions)
+                     're-delta-multibase' in actions)
 
     # Now copy other files in the store directory.
     # The sorted() makes execution deterministic.
@@ -731,7 +744,9 @@
 
 def upgraderepo(ui, repo, run=False, optimize=None):
     """Upgrade a repository in place."""
-    optimize = set(optimize or [])
+    if optimize is None:
+        optimize = []
+    optimize = set(legacy_opts_map.get(o, o) for o in optimize)
     repo = repo.unfiltered()
 
     # Ensure the repository can be upgraded.