##// END OF EJS Templates
scmutil: introduce function to check whether repo uses treemanifest or not...
Pulkit Goyal -
r46129:10284ce3 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 requirements.TREEMANIFEST_REQUIREMENT in repo.requirements:
111 if scmutil.istreemanifest(repo):
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 requirements.TREEMANIFEST_REQUIREMENT in repo.requirements:
166 if scmutil.istreemanifest(repo):
167 part.addparam(b'treemanifest', b'1')
167 part.addparam(b'treemanifest', b'1')
168
168
169
169
@@ -23,7 +23,7 b' from mercurial import ('
23 extensions,
23 extensions,
24 match,
24 match,
25 pycompat,
25 pycompat,
26 requirements,
26 scmutil,
27 store,
27 store,
28 streamclone,
28 streamclone,
29 util,
29 util,
@@ -170,7 +170,7 b' def onetimesetup(ui):'
170 if kind == stat.S_IFDIR:
170 if kind == stat.S_IFDIR:
171 visit.append(fp)
171 visit.append(fp)
172
172
173 if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements:
173 if scmutil.istreemanifest(repo):
174 for (u, e, s) in repo.store.datafiles():
174 for (u, e, s) in repo.store.datafiles():
175 if u.startswith(b'meta/') and (
175 if u.startswith(b'meta/') and (
176 u.endswith(b'.i') or u.endswith(b'.d')
176 u.endswith(b'.i') or u.endswith(b'.d')
@@ -1964,10 +1964,7 b' def handlechangegroup(op, inpart):'
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 b'treemanifest' in inpart.params and not scmutil.istreemanifest(op.repo):
1968 b'treemanifest' in inpart.params
1969 and requirements.TREEMANIFEST_REQUIREMENT not in op.repo.requirements
1970 ):
1971 if len(op.repo.changelog) != 0:
1968 if len(op.repo.changelog) != 0:
1972 raise error.Abort(
1969 raise error.Abort(
1973 _(
1970 _(
@@ -2577,7 +2574,7 b' def widen_bundle('
2577
2574
2578 part = bundler.newpart(b'changegroup', data=cgdata)
2575 part = bundler.newpart(b'changegroup', data=cgdata)
2579 part.addparam(b'version', cgversion)
2576 part.addparam(b'version', cgversion)
2580 if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements:
2577 if scmutil.istreemanifest(repo):
2581 part.addparam(b'treemanifest', b'1')
2578 part.addparam(b'treemanifest', b'1')
2582 if b'exp-sidedata-flag' in repo.requirements:
2579 if b'exp-sidedata-flag' in repo.requirements:
2583 part.addparam(b'exp-sidedata', b'1')
2580 part.addparam(b'exp-sidedata', b'1')
@@ -27,6 +27,7 b' from . import ('
27 phases,
27 phases,
28 pycompat,
28 pycompat,
29 requirements,
29 requirements,
30 scmutil,
30 util,
31 util,
31 )
32 )
32
33
@@ -949,9 +950,7 b' class cgpacker(object):'
949 # Treemanifests don't work correctly with fastpathlinkrev
950 # Treemanifests don't work correctly with fastpathlinkrev
950 # either, because we don't discover which directory nodes to
951 # either, because we don't discover which directory nodes to
951 # send along with files. This could probably be fixed.
952 # send along with files. This could probably be fixed.
952 fastpathlinkrev = fastpathlinkrev and (
953 fastpathlinkrev = fastpathlinkrev and not scmutil.istreemanifest(repo)
953 requirements.TREEMANIFEST_REQUIREMENT not in repo.requirements
954 )
955
954
956 fnodes = {} # needed file nodes
955 fnodes = {} # needed file nodes
957
956
@@ -1468,7 +1467,7 b' def allsupportedversions(repo):'
1468 if (
1467 if (
1469 repo.ui.configbool(b'experimental', b'changegroup3')
1468 repo.ui.configbool(b'experimental', b'changegroup3')
1470 or repo.ui.configbool(b'experimental', b'treemanifest')
1469 or repo.ui.configbool(b'experimental', b'treemanifest')
1471 or requirements.TREEMANIFEST_REQUIREMENT in repo.requirements
1470 or scmutil.istreemanifest(repo)
1472 ):
1471 ):
1473 # 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
1474 #
1473 #
@@ -1496,7 +1495,7 b' def supportedincomingversions(repo):'
1496 # Changegroup versions that can be created from the repo
1495 # Changegroup versions that can be created from the repo
1497 def supportedoutgoingversions(repo):
1496 def supportedoutgoingversions(repo):
1498 versions = allsupportedversions(repo)
1497 versions = allsupportedversions(repo)
1499 if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements:
1498 if scmutil.istreemanifest(repo):
1500 # 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
1501 # expensive to convert between the flat manifest and tree manifest on
1500 # expensive to convert between the flat manifest and tree manifest on
1502 # the fly. Since tree manifests are hashed differently, all of history
1501 # the fly. Since tree manifests are hashed differently, all of history
@@ -46,7 +46,6 b' from . import ('
46 phases,
46 phases,
47 pycompat,
47 pycompat,
48 repair,
48 repair,
49 requirements,
50 revlog,
49 revlog,
51 rewriteutil,
50 rewriteutil,
52 scmutil,
51 scmutil,
@@ -1359,7 +1358,7 b' def openstorage(repo, cmd, file_, opts, '
1359 if cl:
1358 if cl:
1360 r = repo.unfiltered().changelog
1359 r = repo.unfiltered().changelog
1361 elif dir:
1360 elif dir:
1362 if requirements.TREEMANIFEST_REQUIREMENT not in repo.requirements:
1361 if not scmutil.istreemanifest(repo):
1363 raise error.Abort(
1362 raise error.Abort(
1364 _(
1363 _(
1365 b"--dir can only be used on repos with "
1364 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 requirements.TREEMANIFEST_REQUIREMENT in pushop.repo.requirements:
1071 if scmutil.istreemanifest(pushop.repo):
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 requirements.TREEMANIFEST_REQUIREMENT in repo.requirements:
2560 if scmutil.istreemanifest(repo):
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:
@@ -27,6 +27,7 b' from . import ('
27 phases,
27 phases,
28 pycompat,
28 pycompat,
29 requirements,
29 requirements,
30 scmutil,
30 util,
31 util,
31 )
32 )
32 from .utils import (
33 from .utils import (
@@ -419,7 +420,7 b' def stripmanifest(repo, striprev, tr, fi'
419
420
420 def manifestrevlogs(repo):
421 def manifestrevlogs(repo):
421 yield repo.manifestlog.getstorage(b'')
422 yield repo.manifestlog.getstorage(b'')
422 if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements:
423 if scmutil.istreemanifest(repo):
423 # This logic is safe if treemanifest isn't enabled, but also
424 # This logic is safe if treemanifest isn't enabled, but also
424 # pointless, so we skip it if treemanifest isn't enabled.
425 # pointless, so we skip it if treemanifest isn't enabled.
425 for unencoded, encoded, size in repo.store.datafiles():
426 for unencoded, encoded, size in repo.store.datafiles():
@@ -1492,6 +1492,11 b' def filterrequirements(requirements):'
1492 return requirements, None
1492 return requirements, None
1493
1493
1494
1494
1495 def istreemanifest(repo):
1496 """ returns whether the repository is using treemanifest or not """
1497 return requirementsmod.TREEMANIFEST_REQUIREMENT in repo.requirements
1498
1499
1495 def writereporequirements(repo, requirements=None):
1500 def writereporequirements(repo, requirements=None):
1496 """ writes requirements for the repo to .hg/requires """
1501 """ writes requirements for the repo to .hg/requires """
1497 if requirements:
1502 if requirements:
General Comments 0
You need to be logged in to leave comments. Login now