Patchwork D10342: changegroup: don't limit cgv4 to revlogv2 repos

login
register
mail settings
Submitter phabricator
Date April 9, 2021, 8:50 a.m.
Message ID <differential-rev-PHID-DREV-7ahj42hme2c42tp3eqpn-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48658/
State Superseded
Headers show

Comments

phabricator - April 9, 2021, 8:50 a.m.
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10342

AFFECTED FILES
  mercurial/changegroup.py
  mercurial/configitems.py

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -904,6 +904,11 @@ 
 )
 coreconfigitem(
     b'experimental',
+    b'changegroup4',
+    default=False,
+)
+coreconfigitem(
+    b'experimental',
     b'cleanup-as-archived',
     default=False,
 )
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -1687,11 +1687,15 @@ 
         #
         # (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 repo.ui.configbool(b'format', b'exp-use-side-data')
+        or requirements.REVLOGV2_REQUIREMENT in repo.requirements
+    )
+    if not want_v4:
+        versions.discard(b'04')
     return versions