changeset 43059:4bbc9569e722

changegroup: use positive logic for treemanifest changegroup3 logic We are about to add more cases, in that context, it is simpler to avoid double negative. En addition, We document the situation for the next soul. Differential Revision: https://phab.mercurial-scm.org/D6938
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 30 Sep 2019 14:21:05 -0400
parents 808a57a08470
children 63e25ae9cdce
files mercurial/changegroup.py
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Sat Oct 05 07:10:34 2019 -0700
+++ b/mercurial/changegroup.py	Mon Sep 30 14:21:05 2019 -0400
@@ -1281,9 +1281,19 @@
 
 def allsupportedversions(repo):
     versions = set(_packermap.keys())
-    if not (repo.ui.configbool('experimental', 'changegroup3') or
-            repo.ui.configbool('experimental', 'treemanifest') or
-            'treemanifest' in repo.requirements):
+    needv03 = False
+    if (repo.ui.configbool('experimental', 'changegroup3') or
+        repo.ui.configbool('experimental', 'treemanifest') or
+        'treemanifest' in repo.requirements):
+        # we keep version 03 because we need to to exchange treemanifest data
+        #
+        # we also keep vresion 01 and 02, because it is possible for repo to
+        # contains both normal and tree manifest at the same time. so using
+        # older version to pull data is viable
+        #
+        # (or even to push subset of history)
+        needv03 = True
+    if not needv03:
         versions.discard('03')
     return versions