[PATCH 12 of 12] upgrade: simplify the "origin" dispatch in dry run

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


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1491861791 -7200
#      Tue Apr 11 00:03:11 2017 +0200
# Node ID b75621ae42efc24c55d15f064f44137197b06608
# Parent  ed384e9f47907a7521e33012a5cf6f15053f23d3
# 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 b75621ae42ef
upgrade: simplify the "origin" dispatch in dry run

We could compute the final set we need directly.

diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -664,19 +664,16 @@ def upgraderepo(ui, repo, run=False, opt
             ui.write('%s\n   %s\n\n' % (a.name, a.upgrademessage))
 
     if not run:
-        fromdefault = []
         fromconfig = []
+        onlydefault = []
 
         for d in deficiencies:
-            if d.fromdefault:
-                fromdefault.append(d)
             if d.fromconfig:
                 fromconfig.append(d)
+            elif d.fromdefault:
+                onlydefault.append(d)
 
-        if fromdefault or fromconfig:
-            fromconfignames = set(x.name for x in fromconfig)
-            onlydefault = [i for i in fromdefault
-                           if i.name not in fromconfignames]
+        if fromconfig or onlydefault:
 
             if fromconfig:
                 ui.write(_('repository lacks features recommended by '


More information about the Mercurial-devel mailing list