##// END OF EJS Templates
repository: introduce constant for treemanifest requirement and use it...
Pulkit Goyal -
r45931:e58e2340 default
parent child Browse files
Show More
@@ -108,7 +108,7 b' def generateellipsesbundle2('
108
108
109 part = bundler.newpart(b'changegroup', data=cgdata)
109 part = bundler.newpart(b'changegroup', data=cgdata)
110 part.addparam(b'version', version)
110 part.addparam(b'version', version)
111 if b'treemanifest' in repo.requirements:
111 if repository.TREEMANIFEST_REQUIREMENT in repo.requirements:
112 part.addparam(b'treemanifest', b'1')
112 part.addparam(b'treemanifest', b'1')
113
113
114
114
@@ -163,7 +163,7 b' def generate_ellipses_bundle2_for_wideni'
163
163
164 part = bundler.newpart(b'changegroup', data=cgdata)
164 part = bundler.newpart(b'changegroup', data=cgdata)
165 part.addparam(b'version', version)
165 part.addparam(b'version', version)
166 if b'treemanifest' in repo.requirements:
166 if repository.TREEMANIFEST_REQUIREMENT in repo.requirements:
167 part.addparam(b'treemanifest', b'1')
167 part.addparam(b'treemanifest', b'1')
168
168
169
169
@@ -30,6 +30,7 b' from mercurial import ('
30 wireprototypes,
30 wireprototypes,
31 wireprotov1server,
31 wireprotov1server,
32 )
32 )
33 from mercurial.interfaces import repository
33 from . import (
34 from . import (
34 constants,
35 constants,
35 shallowutil,
36 shallowutil,
@@ -169,7 +170,7 b' def onetimesetup(ui):'
169 if kind == stat.S_IFDIR:
170 if kind == stat.S_IFDIR:
170 visit.append(fp)
171 visit.append(fp)
171
172
172 if b'treemanifest' in repo.requirements:
173 if repository.TREEMANIFEST_REQUIREMENT in repo.requirements:
173 for (u, e, s) in repo.store.datafiles():
174 for (u, e, s) in repo.store.datafiles():
174 if u.startswith(b'meta/') and (
175 if u.startswith(b'meta/') and (
175 u.endswith(b'.i') or u.endswith(b'.d')
176 u.endswith(b'.i') or u.endswith(b'.d')
@@ -172,6 +172,7 b' from . import ('
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
@@ -1965,7 +1966,7 b' def handlechangegroup(op, inpart):'
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(
@@ -1974,7 +1975,7 b' def handlechangegroup(op, inpart):'
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 )
@@ -2576,7 +2577,7 b' def widen_bundle('
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')
@@ -949,7 +949,7 b' class cgpacker(object):'
949 # either, because we don't discover which directory nodes to
949 # either, because we don't discover which directory nodes to
950 # send along with files. This could probably be fixed.
950 # send along with files. This could probably be fixed.
951 fastpathlinkrev = fastpathlinkrev and (
951 fastpathlinkrev = fastpathlinkrev and (
952 b'treemanifest' not in repo.requirements
952 repository.TREEMANIFEST_REQUIREMENT not in repo.requirements
953 )
953 )
954
954
955 fnodes = {} # needed file nodes
955 fnodes = {} # needed file nodes
@@ -1467,7 +1467,7 b' def allsupportedversions(repo):'
1467 if (
1467 if (
1468 repo.ui.configbool(b'experimental', b'changegroup3')
1468 repo.ui.configbool(b'experimental', b'changegroup3')
1469 or repo.ui.configbool(b'experimental', b'treemanifest')
1469 or repo.ui.configbool(b'experimental', b'treemanifest')
1470 or b'treemanifest' in repo.requirements
1470 or repository.TREEMANIFEST_REQUIREMENT in repo.requirements
1471 ):
1471 ):
1472 # we keep version 03 because we need to to exchange treemanifest data
1472 # we keep version 03 because we need to to exchange treemanifest data
1473 #
1473 #
@@ -1495,7 +1495,7 b' def supportedincomingversions(repo):'
1495 # Changegroup versions that can be created from the repo
1495 # Changegroup versions that can be created from the repo
1496 def supportedoutgoingversions(repo):
1496 def supportedoutgoingversions(repo):
1497 versions = allsupportedversions(repo)
1497 versions = allsupportedversions(repo)
1498 if b'treemanifest' in repo.requirements:
1498 if repository.TREEMANIFEST_REQUIREMENT in repo.requirements:
1499 # Versions 01 and 02 support only flat manifests and it's just too
1499 # Versions 01 and 02 support only flat manifests and it's just too
1500 # expensive to convert between the flat manifest and tree manifest on
1500 # expensive to convert between the flat manifest and tree manifest on
1501 # the fly. Since tree manifests are hashed differently, all of history
1501 # the fly. Since tree manifests are hashed differently, all of history
@@ -58,6 +58,8 b' from . import ('
58 vfs as vfsmod,
58 vfs as vfsmod,
59 )
59 )
60
60
61 from .interfaces import repository
62
61 from .utils import (
63 from .utils import (
62 dateutil,
64 dateutil,
63 stringutil,
65 stringutil,
@@ -1358,7 +1360,7 b' def openstorage(repo, cmd, file_, opts, '
1358 if cl:
1360 if cl:
1359 r = repo.unfiltered().changelog
1361 r = repo.unfiltered().changelog
1360 elif dir:
1362 elif dir:
1361 if b'treemanifest' not in repo.requirements:
1363 if repository.TREEMANIFEST_REQUIREMENT not in repo.requirements:
1362 raise error.Abort(
1364 raise error.Abort(
1363 _(
1365 _(
1364 b"--dir can only be used on repos with "
1366 b"--dir can only be used on repos with "
@@ -1068,7 +1068,7 b' def _pushb2ctx(pushop, bundler):'
1068 cgpart = bundler.newpart(b'changegroup', data=cgstream)
1068 cgpart = bundler.newpart(b'changegroup', data=cgstream)
1069 if cgversions:
1069 if cgversions:
1070 cgpart.addparam(b'version', version)
1070 cgpart.addparam(b'version', version)
1071 if b'treemanifest' in pushop.repo.requirements:
1071 if repository.TREEMANIFEST_REQUIREMENT in pushop.repo.requirements:
1072 cgpart.addparam(b'treemanifest', b'1')
1072 cgpart.addparam(b'treemanifest', b'1')
1073 if b'exp-sidedata-flag' in pushop.repo.requirements:
1073 if b'exp-sidedata-flag' in pushop.repo.requirements:
1074 cgpart.addparam(b'exp-sidedata', b'1')
1074 cgpart.addparam(b'exp-sidedata', b'1')
@@ -2557,7 +2557,7 b' def _getbundlechangegrouppart('
2557
2557
2558 part.addparam(b'nbchanges', b'%d' % len(outgoing.missing), mandatory=False)
2558 part.addparam(b'nbchanges', b'%d' % len(outgoing.missing), mandatory=False)
2559
2559
2560 if b'treemanifest' in repo.requirements:
2560 if repository.TREEMANIFEST_REQUIREMENT in repo.requirements:
2561 part.addparam(b'treemanifest', b'1')
2561 part.addparam(b'treemanifest', b'1')
2562
2562
2563 if b'exp-sidedata-flag' in repo.requirements:
2563 if b'exp-sidedata-flag' in repo.requirements:
@@ -22,6 +22,9 b" SPARSE_REQUIREMENT = b'exp-sparse'"
22 # of stripping them
22 # of stripping them
23 INTERNAL_PHASE_REQUIREMENT = b'internal-phase'
23 INTERNAL_PHASE_REQUIREMENT = b'internal-phase'
24
24
25 # Stores manifest in Tree structure
26 TREEMANIFEST_REQUIREMENT = b'treemanifest'
27
25 # Local repository feature string.
28 # Local repository feature string.
26
29
27 # Revlogs are being used for file storage.
30 # Revlogs are being used for file storage.
@@ -846,7 +846,7 b' def resolvestorevfsoptions(ui, requireme'
846 """
846 """
847 options = {}
847 options = {}
848
848
849 if b'treemanifest' in requirements:
849 if repository.TREEMANIFEST_REQUIREMENT in requirements:
850 options[b'treemanifest'] = True
850 options[b'treemanifest'] = True
851
851
852 # experimental config: format.manifestcachesize
852 # experimental config: format.manifestcachesize
@@ -1053,7 +1053,7 b' class localrepository(object):'
1053 supportedformats = {
1053 supportedformats = {
1054 b'revlogv1',
1054 b'revlogv1',
1055 b'generaldelta',
1055 b'generaldelta',
1056 b'treemanifest',
1056 repository.TREEMANIFEST_REQUIREMENT,
1057 COPIESSDC_REQUIREMENT,
1057 COPIESSDC_REQUIREMENT,
1058 REVLOGV2_REQUIREMENT,
1058 REVLOGV2_REQUIREMENT,
1059 SIDEDATA_REQUIREMENT,
1059 SIDEDATA_REQUIREMENT,
@@ -3314,7 +3314,7 b' def newreporequirements(ui, createopts):'
3314 requirements.add(SIDEDATA_REQUIREMENT)
3314 requirements.add(SIDEDATA_REQUIREMENT)
3315 requirements.add(COPIESSDC_REQUIREMENT)
3315 requirements.add(COPIESSDC_REQUIREMENT)
3316 if ui.configbool(b'experimental', b'treemanifest'):
3316 if ui.configbool(b'experimental', b'treemanifest'):
3317 requirements.add(b'treemanifest')
3317 requirements.add(repository.TREEMANIFEST_REQUIREMENT)
3318
3318
3319 revlogv2 = ui.config(b'experimental', b'revlogv2')
3319 revlogv2 = ui.config(b'experimental', b'revlogv2')
3320 if revlogv2 == b'enable-unstable-format-and-corrupt-my-data':
3320 if revlogv2 == b'enable-unstable-format-and-corrupt-my-data':
@@ -28,6 +28,7 b' from . import ('
28 pycompat,
28 pycompat,
29 util,
29 util,
30 )
30 )
31 from .interfaces import repository
31 from .utils import (
32 from .utils import (
32 hashutil,
33 hashutil,
33 stringutil,
34 stringutil,
@@ -418,7 +419,7 b' def stripmanifest(repo, striprev, tr, fi'
418
419
419 def manifestrevlogs(repo):
420 def manifestrevlogs(repo):
420 yield repo.manifestlog.getstorage(b'')
421 yield repo.manifestlog.getstorage(b'')
421 if b'treemanifest' in repo.requirements:
422 if repository.TREEMANIFEST_REQUIREMENT in repo.requirements:
422 # This logic is safe if treemanifest isn't enabled, but also
423 # This logic is safe if treemanifest isn't enabled, but also
423 # pointless, so we skip it if treemanifest isn't enabled.
424 # pointless, so we skip it if treemanifest isn't enabled.
424 for unencoded, encoded, size in repo.store.datafiles():
425 for unencoded, encoded, size in repo.store.datafiles():
@@ -476,7 +477,7 b' def rebuildfncache(ui, repo):'
476
477
477 progress.complete()
478 progress.complete()
478
479
479 if b'treemanifest' in repo.requirements:
480 if repository.TREEMANIFEST_REQUIREMENT in repo.requirements:
480 # This logic is safe if treemanifest isn't enabled, but also
481 # This logic is safe if treemanifest isn't enabled, but also
481 # pointless, so we skip it if treemanifest isn't enabled.
482 # pointless, so we skip it if treemanifest isn't enabled.
482 for dir in pathutil.dirs(seenfiles):
483 for dir in pathutil.dirs(seenfiles):
@@ -26,6 +26,7 b' from . import ('
26 vfs as vfsmod,
26 vfs as vfsmod,
27 )
27 )
28
28
29 from .interfaces import repository
29 from .utils import compression
30 from .utils import compression
30
31
31 # list of requirements that request a clone of all revlog if added/removed
32 # list of requirements that request a clone of all revlog if added/removed
@@ -58,7 +59,7 b' def blocksourcerequirements(repo):'
58 return {
59 return {
59 # The upgrade code does not yet support these experimental features.
60 # The upgrade code does not yet support these experimental features.
60 # This is an artificial limitation.
61 # This is an artificial limitation.
61 b'treemanifest',
62 repository.TREEMANIFEST_REQUIREMENT,
62 # This was a precursor to generaldelta and was never enabled by default.
63 # This was a precursor to generaldelta and was never enabled by default.
63 # It should (hopefully) not exist in the wild.
64 # It should (hopefully) not exist in the wild.
64 b'parentdelta',
65 b'parentdelta',
General Comments 0
You need to be logged in to leave comments. Login now