# HG changeset patch
# User Boris Feld
# Date 1531443930 -7200
# Fri Jul 13 03:05:30 2018 +0200
# Node ID 67ee61288306b5f74c2151a3e71a5321bc5989cb
# Parent 8ca558d1dc064bef67b6fb4341feecddceb216ce
# EXP-Topic upgrade-test
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
67ee61288306
upgrade: add '-' in optimisation name
The older name `redeltaall` were hard to type and read. The newer form should be
more user friendly.
We keep backward compatibility with the old form (at least for a while). Having
to use different form depending on the version is very impractical and error
prone.
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -348,6 +348,19 @@ def finddeficiencies(repo):
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 @@ def findoptimizations(repo):
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 @@ def findoptimizations(repo):
'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 @@ def findoptimizations(repo):
'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 @@ def findoptimizations(repo):
'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 @@ def _upgraderepo(ui, srcrepo, dstrepo, r
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, srcrepo, dstrepo, r
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