changeset 30628:a001cd7296a5

changegroup: simplify logic around enabling changegroup 03 There was multiple spot that took care of adding '03' as supported changegroup version for different condition. We gather them all in one location for simplicity. The 'supportedincomingversions' function is now doing nothing, but I kept it around because it looks like a great hooking point for extension. (Note that we should probably just get changegroup3 out of experimental now, But that would be a patch with a much wider scope).
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 19 Dec 2016 04:25:18 +0100
parents 7ace5304fec5
children e92776c00ffd
files mercurial/changegroup.py
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Mon Dec 19 04:29:33 2016 +0100
+++ b/mercurial/changegroup.py	Mon Dec 19 04:25:18 2016 +0100
@@ -877,16 +877,14 @@
 def allsupportedversions(repo):
     versions = set(_packermap.keys())
     if not (repo.ui.configbool('experimental', 'changegroup3') or
-            repo.ui.configbool('experimental', 'treemanifest')):
+            repo.ui.configbool('experimental', 'treemanifest') or
+            'treemanifest' in repo.requirements):
         versions.discard('03')
     return versions
 
 # Changegroup versions that can be applied to the repo
 def supportedincomingversions(repo):
-    versions = allsupportedversions(repo)
-    if 'treemanifest' in repo.requirements:
-        versions.add('03')
-    return versions
+    return allsupportedversions(repo)
 
 # Changegroup versions that can be created from the repo
 def supportedoutgoingversions(repo):
@@ -899,7 +897,6 @@
         # support versions 01 and 02.
         versions.discard('01')
         versions.discard('02')
-        versions.add('03')
     return versions
 
 def safeversion(repo):