Patchwork [09,of,12] upgrade: simplify some of the initial dispatch for dry run

login
register
mail settings
Submitter Pierre-Yves David
Date April 11, 2017, 10:47 p.m.
Message ID <9dccc5b939acea2e559e.1491950869@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20117/
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 1491855317 -7200
#      Mon Apr 10 22:15:17 2017 +0200
# Node ID 9dccc5b939acea2e559e70024fd5373f9ecc18ce
# Parent  d597e0ce2aaaab926589a648caaf2cc6de0c14ce
# 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 9dccc5b939ac
upgrade: simplify some of the initial dispatch for dry run

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

Patch

diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -664,17 +664,12 @@  def upgraderepo(ui, repo, run=False, opt
     if not run:
         fromdefault = []
         fromconfig = []
-        optimizations = []
 
-        for i in improvements:
-            assert i.type in (deficiency, optimisation)
-            if i.type == deficiency:
-                if i.fromdefault:
-                    fromdefault.append(i)
-                if i.fromconfig:
-                    fromconfig.append(i)
-            else:
-                optimizations.append(i)
+        for d in deficiencies:
+            if d.fromdefault:
+                fromdefault.append(d)
+            if d.fromconfig:
+                fromconfig.append(d)
 
         if fromdefault or fromconfig:
             fromconfignames = set(x.name for x in fromconfig)