diff mercurial/bundle2.py @ 47237:19d4802cb304

sidedata: add a 'side-data' repository feature and use it Most code don't really care how sidedata support is added, but it needs to know if it is present. To achieve this. we use the `repo.features` attributes with a new dedicated features". Having such centralised information is more robust and will help us to remove the sidedata requirements in a later changesets. Differential Revision: https://phab.mercurial-scm.org/D10617
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 03 May 2021 12:29:52 +0200
parents bea4717415c0
children fff5942d445f
line wrap: on
line diff
--- a/mercurial/bundle2.py	Mon May 03 12:29:41 2021 +0200
+++ b/mercurial/bundle2.py	Mon May 03 12:29:52 2021 +0200
@@ -180,6 +180,7 @@
     stringutil,
     urlutil,
 )
+from .interfaces import repository
 
 urlerr = util.urlerr
 urlreq = util.urlreq
@@ -1729,8 +1730,8 @@
             part.addparam(
                 b'targetphase', b'%d' % phases.secret, mandatory=False
             )
-        if b'exp-sidedata-flag' in repo.requirements:
-            part.addparam(b'exp-sidedata', b'1')
+    if repository.REPO_FEATURE_SIDE_DATA in repo.features:
+        part.addparam(b'exp-sidedata', b'1')
 
     if opts.get(b'streamv2', False):
         addpartbundlestream2(bundler, repo, stream=True)
@@ -2579,9 +2580,9 @@
         part.addparam(b'version', cgversion)
         if scmutil.istreemanifest(repo):
             part.addparam(b'treemanifest', b'1')
-        if b'exp-sidedata-flag' in repo.requirements:
-            part.addparam(b'exp-sidedata', b'1')
-            wanted = format_remote_wanted_sidedata(repo)
-            part.addparam(b'exp-wanted-sidedata', wanted)
+    if repository.REPO_FEATURE_SIDE_DATA in repo.features:
+        part.addparam(b'exp-sidedata', b'1')
+        wanted = format_remote_wanted_sidedata(repo)
+        part.addparam(b'exp-wanted-sidedata', wanted)
 
     return bundler