changegroup: don't limit cgv4 to revlogv2 repos
authorRaphaël Gomès <rgomes@octobus.net>
Thu, 08 Apr 2021 16:34:11 +0200
changeset 47076 08e26ef4ad35
parent 47075 5554aacd783f
child 47077 119790e1c67c
changegroup: don't limit cgv4 to revlogv2 repos To help the transition from revlogv1 to revlogv2, we need to be able to enable cgv4 for revlogv1 repos, so that revlogv2 clients can handle adding/removing sidedata over the wire. Differential Revision: https://phab.mercurial-scm.org/D10342
mercurial/changegroup.py
mercurial/configitems.py
--- a/mercurial/changegroup.py	Thu Apr 08 16:39:39 2021 +0200
+++ b/mercurial/changegroup.py	Thu Apr 08 16:34:11 2021 +0200
@@ -1689,11 +1689,14 @@
         #
         # (or even to push subset of history)
         needv03 = True
-    has_revlogv2 = requirements.REVLOGV2_REQUIREMENT in repo.requirements
-    if not has_revlogv2:
-        versions.discard(b'04')
     if not needv03:
         versions.discard(b'03')
+    want_v4 = (
+        repo.ui.configbool(b'experimental', b'changegroup4')
+        or requirements.REVLOGV2_REQUIREMENT in repo.requirements
+    )
+    if not want_v4:
+        versions.discard(b'04')
     return versions
 
 
--- a/mercurial/configitems.py	Thu Apr 08 16:39:39 2021 +0200
+++ b/mercurial/configitems.py	Thu Apr 08 16:34:11 2021 +0200
@@ -904,6 +904,11 @@
 )
 coreconfigitem(
     b'experimental',
+    b'changegroup4',
+    default=False,
+)
+coreconfigitem(
+    b'experimental',
     b'cleanup-as-archived',
     default=False,
 )