Patchwork [06,of,12] upgrade: directly iterate over optimisations

login
register
mail settings
Submitter Pierre-Yves David
Date April 11, 2017, 10:47 p.m.
Message ID <3c80a99ee76292613a6c.1491950866@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20119/
State Accepted
Headers show

Comments

Pierre-Yves David - April 11, 2017, 10:47 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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)

Patch

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'))