Mercurial > hg
comparison mercurial/bundle2.py @ 45372:77b8588dd84e
requirements: introduce new requirements related module
It was not clear where all requirements should and related APIs should be, this
patch introduces a requirements module which will have all exitsing requirements
and related APIs.
Differential Revision: https://phab.mercurial-scm.org/D8917
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sat, 08 Aug 2020 16:24:12 +0530 |
parents | e58e234096de |
children | 10284ce3d5ed |
comparison
equal
deleted
inserted
replaced
45371:e58e234096de | 45372:77b8588dd84e |
---|---|
164 node as nodemod, | 164 node as nodemod, |
165 obsolete, | 165 obsolete, |
166 phases, | 166 phases, |
167 pushkey, | 167 pushkey, |
168 pycompat, | 168 pycompat, |
169 requirements, | |
169 scmutil, | 170 scmutil, |
170 streamclone, | 171 streamclone, |
171 tags, | 172 tags, |
172 url, | 173 url, |
173 util, | 174 util, |
174 ) | 175 ) |
175 from .interfaces import repository | |
176 from .utils import stringutil | 176 from .utils import stringutil |
177 | 177 |
178 urlerr = util.urlerr | 178 urlerr = util.urlerr |
179 urlreq = util.urlreq | 179 urlreq = util.urlreq |
180 | 180 |
1964 nbchangesets = None | 1964 nbchangesets = None |
1965 if b'nbchanges' in inpart.params: | 1965 if b'nbchanges' in inpart.params: |
1966 nbchangesets = int(inpart.params.get(b'nbchanges')) | 1966 nbchangesets = int(inpart.params.get(b'nbchanges')) |
1967 if ( | 1967 if ( |
1968 b'treemanifest' in inpart.params | 1968 b'treemanifest' in inpart.params |
1969 and repository.TREEMANIFEST_REQUIREMENT not in op.repo.requirements | 1969 and requirements.TREEMANIFEST_REQUIREMENT not in op.repo.requirements |
1970 ): | 1970 ): |
1971 if len(op.repo.changelog) != 0: | 1971 if len(op.repo.changelog) != 0: |
1972 raise error.Abort( | 1972 raise error.Abort( |
1973 _( | 1973 _( |
1974 b"bundle contains tree manifests, but local repo is " | 1974 b"bundle contains tree manifests, but local repo is " |
1975 b"non-empty and does not use tree manifests" | 1975 b"non-empty and does not use tree manifests" |
1976 ) | 1976 ) |
1977 ) | 1977 ) |
1978 op.repo.requirements.add(repository.TREEMANIFEST_REQUIREMENT) | 1978 op.repo.requirements.add(requirements.TREEMANIFEST_REQUIREMENT) |
1979 op.repo.svfs.options = localrepo.resolvestorevfsoptions( | 1979 op.repo.svfs.options = localrepo.resolvestorevfsoptions( |
1980 op.repo.ui, op.repo.requirements, op.repo.features | 1980 op.repo.ui, op.repo.requirements, op.repo.features |
1981 ) | 1981 ) |
1982 scmutil.writereporequirements(op.repo) | 1982 scmutil.writereporequirements(op.repo) |
1983 | 1983 |
2575 changelog=False, | 2575 changelog=False, |
2576 ) | 2576 ) |
2577 | 2577 |
2578 part = bundler.newpart(b'changegroup', data=cgdata) | 2578 part = bundler.newpart(b'changegroup', data=cgdata) |
2579 part.addparam(b'version', cgversion) | 2579 part.addparam(b'version', cgversion) |
2580 if repository.TREEMANIFEST_REQUIREMENT in repo.requirements: | 2580 if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements: |
2581 part.addparam(b'treemanifest', b'1') | 2581 part.addparam(b'treemanifest', b'1') |
2582 if b'exp-sidedata-flag' in repo.requirements: | 2582 if b'exp-sidedata-flag' in repo.requirements: |
2583 part.addparam(b'exp-sidedata', b'1') | 2583 part.addparam(b'exp-sidedata', b'1') |
2584 | 2584 |
2585 return bundler | 2585 return bundler |