[PATCH 06 of 12] upgrade: directly iterate over optimisations

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Apr 11 18:47:46 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1491583587 -7200
#      Fri Apr 07 18:46:27 2017 +0200
# Node ID 3c80a99ee76292613a6cbaaa5a69d353f7dfa9a7
# Parent  939b9fb52a24570047a29398c24c1cfe02811cfb
# EXP-Topic upgraderepo
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 3c80a99ee762
upgrade: directly iterate over optimisations

Since we already have the list of optimisations independent from the
deficiencies, we can use it directly.

(we make a dual assignement in this changeset to simplify the next one)

diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -621,7 +621,7 @@ def upgraderepo(ui, repo, run=False, opt
                           _(', ').join(sorted(unsupportedreqs)))
 
     # Find and validate all improvements that can be made.
-    optimizations = findoptimizations(repo)
+    alloptimizations = optimizations = findoptimizations(repo)
 
     # Validate arguments.
     unknownoptimize = optimize - set(i.name for i in optimizations)
@@ -701,8 +701,8 @@ def upgraderepo(ui, repo, run=False, opt
         printrequirements()
         printupgradeactions()
 
-        unusedoptimize = [i for i in improvements
-                          if i.name not in actions and i.type == optimisation]
+        unusedoptimize = [i for i in alloptimizations
+                          if i.name not in actions]
         if unusedoptimize:
             ui.write(_('additional optimizations are available by specifying '
                      '"--optimize <name>":\n\n'))


More information about the Mercurial-devel mailing list