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