comparison mercurial/bundle2.py @ 45371:e58e234096de

repository: introduce constant for treemanifest requirement and use it In future we will like to much cleaner logic around which requirement is for working copy and which can go in store. To start with that, we first need to de-clutter the requirement values spread around and replace them with constants. Differential Revision: https://phab.mercurial-scm.org/D8916
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 08 Aug 2020 15:48:17 +0530
parents c93dd9d9f1e6
children 77b8588dd84e
comparison
equal deleted inserted replaced
45370:15d35f2ba474 45371:e58e234096de
170 streamclone, 170 streamclone,
171 tags, 171 tags,
172 url, 172 url,
173 util, 173 util,
174 ) 174 )
175 from .interfaces import repository
175 from .utils import stringutil 176 from .utils import stringutil
176 177
177 urlerr = util.urlerr 178 urlerr = util.urlerr
178 urlreq = util.urlreq 179 urlreq = util.urlreq
179 180
1963 nbchangesets = None 1964 nbchangesets = None
1964 if b'nbchanges' in inpart.params: 1965 if b'nbchanges' in inpart.params:
1965 nbchangesets = int(inpart.params.get(b'nbchanges')) 1966 nbchangesets = int(inpart.params.get(b'nbchanges'))
1966 if ( 1967 if (
1967 b'treemanifest' in inpart.params 1968 b'treemanifest' in inpart.params
1968 and b'treemanifest' not in op.repo.requirements 1969 and repository.TREEMANIFEST_REQUIREMENT not in op.repo.requirements
1969 ): 1970 ):
1970 if len(op.repo.changelog) != 0: 1971 if len(op.repo.changelog) != 0:
1971 raise error.Abort( 1972 raise error.Abort(
1972 _( 1973 _(
1973 b"bundle contains tree manifests, but local repo is " 1974 b"bundle contains tree manifests, but local repo is "
1974 b"non-empty and does not use tree manifests" 1975 b"non-empty and does not use tree manifests"
1975 ) 1976 )
1976 ) 1977 )
1977 op.repo.requirements.add(b'treemanifest') 1978 op.repo.requirements.add(repository.TREEMANIFEST_REQUIREMENT)
1978 op.repo.svfs.options = localrepo.resolvestorevfsoptions( 1979 op.repo.svfs.options = localrepo.resolvestorevfsoptions(
1979 op.repo.ui, op.repo.requirements, op.repo.features 1980 op.repo.ui, op.repo.requirements, op.repo.features
1980 ) 1981 )
1981 scmutil.writereporequirements(op.repo) 1982 scmutil.writereporequirements(op.repo)
1982 1983
2574 changelog=False, 2575 changelog=False,
2575 ) 2576 )
2576 2577
2577 part = bundler.newpart(b'changegroup', data=cgdata) 2578 part = bundler.newpart(b'changegroup', data=cgdata)
2578 part.addparam(b'version', cgversion) 2579 part.addparam(b'version', cgversion)
2579 if b'treemanifest' in repo.requirements: 2580 if repository.TREEMANIFEST_REQUIREMENT in repo.requirements:
2580 part.addparam(b'treemanifest', b'1') 2581 part.addparam(b'treemanifest', b'1')
2581 if b'exp-sidedata-flag' in repo.requirements: 2582 if b'exp-sidedata-flag' in repo.requirements:
2582 part.addparam(b'exp-sidedata', b'1') 2583 part.addparam(b'exp-sidedata', b'1')
2583 2584
2584 return bundler 2585 return bundler