comparison mercurial/exchange.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 d55b71393907
children f03e9d30258e
comparison
equal deleted inserted replaced
47225:d00177d08139 47226:19d4802cb304
41 from .utils import ( 41 from .utils import (
42 hashutil, 42 hashutil,
43 stringutil, 43 stringutil,
44 urlutil, 44 urlutil,
45 ) 45 )
46 from .interfaces import repository
46 47
47 urlerr = util.urlerr 48 urlerr = util.urlerr
48 urlreq = util.urlreq 49 urlreq = util.urlreq
49 50
50 _NARROWACL_SECTION = b'narrowacl' 51 _NARROWACL_SECTION = b'narrowacl'
891 cgpart = bundler.newpart(b'changegroup', data=cgstream) 892 cgpart = bundler.newpart(b'changegroup', data=cgstream)
892 if cgversions: 893 if cgversions:
893 cgpart.addparam(b'version', version) 894 cgpart.addparam(b'version', version)
894 if scmutil.istreemanifest(pushop.repo): 895 if scmutil.istreemanifest(pushop.repo):
895 cgpart.addparam(b'treemanifest', b'1') 896 cgpart.addparam(b'treemanifest', b'1')
896 if b'exp-sidedata-flag' in pushop.repo.requirements: 897 if repository.REPO_FEATURE_SIDE_DATA in pushop.repo.features:
897 cgpart.addparam(b'exp-sidedata', b'1') 898 cgpart.addparam(b'exp-sidedata', b'1')
898 899
899 def handlereply(op): 900 def handlereply(op):
900 """extract addchangegroup returns from server reply""" 901 """extract addchangegroup returns from server reply"""
901 cgreplies = op.records.getreplies(cgpart.id) 902 cgreplies = op.records.getreplies(cgpart.id)
2425 part.addparam(b'nbchanges', b'%d' % len(outgoing.missing), mandatory=False) 2426 part.addparam(b'nbchanges', b'%d' % len(outgoing.missing), mandatory=False)
2426 2427
2427 if scmutil.istreemanifest(repo): 2428 if scmutil.istreemanifest(repo):
2428 part.addparam(b'treemanifest', b'1') 2429 part.addparam(b'treemanifest', b'1')
2429 2430
2430 if b'exp-sidedata-flag' in repo.requirements: 2431 if repository.REPO_FEATURE_SIDE_DATA in repo.features:
2431 part.addparam(b'exp-sidedata', b'1') 2432 part.addparam(b'exp-sidedata', b'1')
2432 sidedata = bundle2.format_remote_wanted_sidedata(repo) 2433 sidedata = bundle2.format_remote_wanted_sidedata(repo)
2433 part.addparam(b'exp-wanted-sidedata', sidedata) 2434 part.addparam(b'exp-wanted-sidedata', sidedata)
2434 2435
2435 if ( 2436 if (