Patchwork [1,of,3] changegroup: simplify 'allsupportedversions' logic

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 19, 2016, 6:41 a.m.
Message ID <a03103bb5979f59d82a5.1482129681@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/17966/
State Accepted
Headers show

Comments

Pierre-Yves David - Dec. 19, 2016, 6:41 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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