[PATCH 3 of 3] changegroup: simplify logic around enabling changegroup 03

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

# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1482117918 -3600
#      Mon Dec 19 04:25:18 2016 +0100
# Node ID e62c766c60a19d89c4e0e50881701135c251fb6f
# Parent  fef4a4a522c7ea405d8a036213223dca79fc3f84
# EXP-Topic cleanup.changegroup
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

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).

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -877,16 +877,14 @@ class cg3packer(cg2packer):
 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):
     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 @@ def supportedoutgoingversions(repo):
         # support versions 01 and 02.
-        versions.add('03')
     return versions
 def safeversion(repo):

More information about the Mercurial-devel mailing list