Mercurial > public > mercurial-scm > hg-stable
diff mercurial/upgrade.py @ 41091:5608b5a6c323
upgrade: add '-' in optimization name
The older name `redeltaall` was 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.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Fri, 13 Jul 2018 03:05:30 +0200 |
parents | 038108a9811c |
children | a59a74721c76 |
line wrap: on
line diff
--- 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.