Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.py @ 47226: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 |
comparison
equal
deleted
inserted
replaced
47225:d00177d08139 | 47226:19d4802cb304 |
---|---|
178 ) | 178 ) |
179 from .utils import ( | 179 from .utils import ( |
180 stringutil, | 180 stringutil, |
181 urlutil, | 181 urlutil, |
182 ) | 182 ) |
183 from .interfaces import repository | |
183 | 184 |
184 urlerr = util.urlerr | 185 urlerr = util.urlerr |
185 urlreq = util.urlreq | 186 urlreq = util.urlreq |
186 | 187 |
187 _pack = struct.pack | 188 _pack = struct.pack |
1727 b'%ln and secret()', outgoing.ancestorsof | 1728 b'%ln and secret()', outgoing.ancestorsof |
1728 ): | 1729 ): |
1729 part.addparam( | 1730 part.addparam( |
1730 b'targetphase', b'%d' % phases.secret, mandatory=False | 1731 b'targetphase', b'%d' % phases.secret, mandatory=False |
1731 ) | 1732 ) |
1732 if b'exp-sidedata-flag' in repo.requirements: | 1733 if repository.REPO_FEATURE_SIDE_DATA in repo.features: |
1733 part.addparam(b'exp-sidedata', b'1') | 1734 part.addparam(b'exp-sidedata', b'1') |
1734 | 1735 |
1735 if opts.get(b'streamv2', False): | 1736 if opts.get(b'streamv2', False): |
1736 addpartbundlestream2(bundler, repo, stream=True) | 1737 addpartbundlestream2(bundler, repo, stream=True) |
1737 | 1738 |
1738 if opts.get(b'tagsfnodescache', True): | 1739 if opts.get(b'tagsfnodescache', True): |
2577 | 2578 |
2578 part = bundler.newpart(b'changegroup', data=cgdata) | 2579 part = bundler.newpart(b'changegroup', data=cgdata) |
2579 part.addparam(b'version', cgversion) | 2580 part.addparam(b'version', cgversion) |
2580 if scmutil.istreemanifest(repo): | 2581 if scmutil.istreemanifest(repo): |
2581 part.addparam(b'treemanifest', b'1') | 2582 part.addparam(b'treemanifest', b'1') |
2582 if b'exp-sidedata-flag' in repo.requirements: | 2583 if repository.REPO_FEATURE_SIDE_DATA in repo.features: |
2583 part.addparam(b'exp-sidedata', b'1') | 2584 part.addparam(b'exp-sidedata', b'1') |
2584 wanted = format_remote_wanted_sidedata(repo) | 2585 wanted = format_remote_wanted_sidedata(repo) |
2585 part.addparam(b'exp-wanted-sidedata', wanted) | 2586 part.addparam(b'exp-wanted-sidedata', wanted) |
2586 | 2587 |
2587 return bundler | 2588 return bundler |