[PATCH 1 of 3] changegroup: simplify 'allsupportedversions' logic

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Dec 19 01:41:21 EST 2016


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1482118273 -3600
#      Mon Dec 19 04:31:13 2016 +0100
# Node ID a03103bb5979f59d82a5fb8a383cc057bd9ceab6
# Parent  07025bd744a09dd5622e16ccef11966fda7b86f2
# EXP-Topic cleanup.changegroup
changegroup: simplify 'allsupportedversions' logic

Discarding '03' to add it back is a bit strange. Instead we only discard it when
needed.

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -876,10 +876,9 @@ class cg3packer(cg2packer):
 
 def allsupportedversions(ui):
     versions = set(_packermap.keys())
-    versions.discard('03')
-    if (ui.configbool('experimental', 'changegroup3') or
-        ui.configbool('experimental', 'treemanifest')):
-        versions.add('03')
+    if not (ui.configbool('experimental', 'changegroup3') or
+            ui.configbool('experimental', 'treemanifest')):
+        versions.discard('03')
     return versions
 
 # Changegroup versions that can be applied to the repo


More information about the Mercurial-devel mailing list