changegroup: simplify 'allsupportedversions' logic
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Mon, 19 Dec 2016 04:31:13 +0100
changeset 30626 438532c99b54
parent 30625 bcf4a975f93d
child 30627 7ace5304fec5
changegroup: simplify 'allsupportedversions' logic Discarding '03' to add it back is a bit strange. Instead we only discard it when needed.
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Sun Dec 18 01:17:12 2016 +0530
+++ b/mercurial/changegroup.py	Mon Dec 19 04:31:13 2016 +0100
@@ -876,10 +876,9 @@
 
 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