Show More
@@ -0,0 +1,22 b'' | |||
|
1 | # requirements.py - objects and functions related to repository requirements | |
|
2 | # | |
|
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | |
|
4 | # | |
|
5 | # This software may be used and distributed according to the terms of the | |
|
6 | # GNU General Public License version 2 or any later version. | |
|
7 | ||
|
8 | from __future__ import absolute_import | |
|
9 | ||
|
10 | # When narrowing is finalized and no longer subject to format changes, | |
|
11 | # we should move this to just "narrow" or similar. | |
|
12 | NARROW_REQUIREMENT = b'narrowhg-experimental' | |
|
13 | ||
|
14 | # Enables sparse working directory usage | |
|
15 | SPARSE_REQUIREMENT = b'exp-sparse' | |
|
16 | ||
|
17 | # Enables the internal phase which is used to hide changesets instead | |
|
18 | # of stripping them | |
|
19 | INTERNAL_PHASE_REQUIREMENT = b'internal-phase' | |
|
20 | ||
|
21 | # Stores manifest in Tree structure | |
|
22 | TREEMANIFEST_REQUIREMENT = b'treemanifest' |
@@ -11,9 +11,9 b' from __future__ import absolute_import' | |||
|
11 | 11 | from mercurial import ( |
|
12 | 12 | localrepo, |
|
13 | 13 | registrar, |
|
14 | requirements, | |
|
14 | 15 | ) |
|
15 | 16 | |
|
16 | from mercurial.interfaces import repository | |
|
17 | 17 | |
|
18 | 18 | from . import ( |
|
19 | 19 | narrowbundle2, |
@@ -52,7 +52,7 b' cmdtable = narrowcommands.table' | |||
|
52 | 52 | |
|
53 | 53 | |
|
54 | 54 | def featuresetup(ui, features): |
|
55 |
features.add(re |
|
|
55 | features.add(requirements.NARROW_REQUIREMENT) | |
|
56 | 56 | |
|
57 | 57 | |
|
58 | 58 | def uisetup(ui): |
@@ -69,7 +69,7 b' def reposetup(ui, repo):' | |||
|
69 | 69 | return |
|
70 | 70 | |
|
71 | 71 | repo.ui.setconfig(b'experimental', b'narrow', True, b'narrow-ext') |
|
72 |
if re |
|
|
72 | if requirements.NARROW_REQUIREMENT in repo.requirements: | |
|
73 | 73 | narrowrepo.wraprepo(repo) |
|
74 | 74 | narrowwirepeer.reposetup(repo) |
|
75 | 75 |
@@ -20,11 +20,11 b' from mercurial import (' | |||
|
20 | 20 | localrepo, |
|
21 | 21 | narrowspec, |
|
22 | 22 | repair, |
|
23 | requirements, | |
|
23 | 24 | scmutil, |
|
24 | 25 | util, |
|
25 | 26 | wireprototypes, |
|
26 | 27 | ) |
|
27 | from mercurial.interfaces import repository | |
|
28 | 28 | from mercurial.utils import stringutil |
|
29 | 29 | |
|
30 | 30 | _NARROWACL_SECTION = b'narrowacl' |
@@ -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 re |
|
|
111 | if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements: | |
|
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 re |
|
|
166 | if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements: | |
|
167 | 167 | part.addparam(b'treemanifest', b'1') |
|
168 | 168 | |
|
169 | 169 | |
@@ -178,8 +178,8 b' def _handlechangespec_2(op, inpart):' | |||
|
178 | 178 | narrowspec.validatepatterns(includepats) |
|
179 | 179 | narrowspec.validatepatterns(excludepats) |
|
180 | 180 | |
|
181 |
if not re |
|
|
182 |
op.repo.requirements.add(re |
|
|
181 | if not requirements.NARROW_REQUIREMENT in op.repo.requirements: | |
|
182 | op.repo.requirements.add(requirements.NARROW_REQUIREMENT) | |
|
183 | 183 | scmutil.writereporequirements(op.repo) |
|
184 | 184 | op.repo.setnarrowpats(includepats, excludepats) |
|
185 | 185 | narrowspec.copytoworkingcopy(op.repo) |
@@ -194,8 +194,8 b' def _handlenarrowspecs(op, inpart):' | |||
|
194 | 194 | narrowspec.validatepatterns(includepats) |
|
195 | 195 | narrowspec.validatepatterns(excludepats) |
|
196 | 196 | |
|
197 |
if re |
|
|
198 |
op.repo.requirements.add(re |
|
|
197 | if requirements.NARROW_REQUIREMENT not in op.repo.requirements: | |
|
198 | op.repo.requirements.add(requirements.NARROW_REQUIREMENT) | |
|
199 | 199 | scmutil.writereporequirements(op.repo) |
|
200 | 200 | op.repo.setnarrowpats(includepats, excludepats) |
|
201 | 201 | narrowspec.copytoworkingcopy(op.repo) |
@@ -27,11 +27,11 b' from mercurial import (' | |||
|
27 | 27 | registrar, |
|
28 | 28 | repair, |
|
29 | 29 | repoview, |
|
30 | requirements, | |
|
30 | 31 | sparse, |
|
31 | 32 | util, |
|
32 | 33 | wireprototypes, |
|
33 | 34 | ) |
|
34 | from mercurial.interfaces import repository | |
|
35 | 35 | |
|
36 | 36 | table = {} |
|
37 | 37 | command = registrar.command(table) |
@@ -133,7 +133,7 b' def clonenarrowcmd(orig, ui, repo, *args' | |||
|
133 | 133 | def pullnarrowcmd(orig, ui, repo, *args, **opts): |
|
134 | 134 | """Wraps pull command to allow modifying narrow spec.""" |
|
135 | 135 | wrappedextraprepare = util.nullcontextmanager() |
|
136 |
if re |
|
|
136 | if requirements.NARROW_REQUIREMENT in repo.requirements: | |
|
137 | 137 | |
|
138 | 138 | def pullbundle2extraprepare_widen(orig, pullop, kwargs): |
|
139 | 139 | orig(pullop, kwargs) |
@@ -150,7 +150,7 b' def pullnarrowcmd(orig, ui, repo, *args,' | |||
|
150 | 150 | |
|
151 | 151 | def archivenarrowcmd(orig, ui, repo, *args, **opts): |
|
152 | 152 | """Wraps archive command to narrow the default includes.""" |
|
153 |
if re |
|
|
153 | if requirements.NARROW_REQUIREMENT in repo.requirements: | |
|
154 | 154 | repo_includes, repo_excludes = repo.narrowpats |
|
155 | 155 | includes = set(opts.get('include', [])) |
|
156 | 156 | excludes = set(opts.get('exclude', [])) |
@@ -166,7 +166,7 b' def archivenarrowcmd(orig, ui, repo, *ar' | |||
|
166 | 166 | |
|
167 | 167 | def pullbundle2extraprepare(orig, pullop, kwargs): |
|
168 | 168 | repo = pullop.repo |
|
169 |
if re |
|
|
169 | if requirements.NARROW_REQUIREMENT not in repo.requirements: | |
|
170 | 170 | return orig(pullop, kwargs) |
|
171 | 171 | |
|
172 | 172 | if wireprototypes.NARROWCAP not in pullop.remote.capabilities(): |
@@ -482,7 +482,7 b' def trackedcmd(ui, repo, remotepath=None' | |||
|
482 | 482 | exclude switches, the changes are applied immediately. |
|
483 | 483 | """ |
|
484 | 484 | opts = pycompat.byteskwargs(opts) |
|
485 |
if re |
|
|
485 | if requirements.NARROW_REQUIREMENT not in repo.requirements: | |
|
486 | 486 | raise error.Abort( |
|
487 | 487 | _( |
|
488 | 488 | b'the tracked command is only supported on ' |
@@ -23,6 +23,7 b' from mercurial import (' | |||
|
23 | 23 | extensions, |
|
24 | 24 | match, |
|
25 | 25 | pycompat, |
|
26 | requirements, | |
|
26 | 27 | store, |
|
27 | 28 | streamclone, |
|
28 | 29 | util, |
@@ -30,7 +31,6 b' from mercurial import (' | |||
|
30 | 31 | wireprototypes, |
|
31 | 32 | wireprotov1server, |
|
32 | 33 | ) |
|
33 | from mercurial.interfaces import repository | |
|
34 | 34 | from . import ( |
|
35 | 35 | constants, |
|
36 | 36 | shallowutil, |
@@ -170,7 +170,7 b' def onetimesetup(ui):' | |||
|
170 | 170 | if kind == stat.S_IFDIR: |
|
171 | 171 | visit.append(fp) |
|
172 | 172 | |
|
173 |
if re |
|
|
173 | if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements: | |
|
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') |
@@ -67,6 +67,7 b' from mercurial import (' | |||
|
67 | 67 | mdiff, |
|
68 | 68 | pycompat, |
|
69 | 69 | registrar, |
|
70 | requirements, | |
|
70 | 71 | util, |
|
71 | 72 | verify, |
|
72 | 73 | ) |
@@ -1151,7 +1152,7 b' def featuresetup(ui, supported):' | |||
|
1151 | 1152 | supported.add(REQUIREMENT_ZLIB) |
|
1152 | 1153 | supported.add(REQUIREMENT_NONE) |
|
1153 | 1154 | supported.add(REQUIREMENT_SHALLOW_FILES) |
|
1154 |
supported.add(re |
|
|
1155 | supported.add(requirements.NARROW_REQUIREMENT) | |
|
1155 | 1156 | |
|
1156 | 1157 | |
|
1157 | 1158 | def newreporequirements(orig, ui, createopts): |
@@ -166,13 +166,13 b' from . import (' | |||
|
166 | 166 | phases, |
|
167 | 167 | pushkey, |
|
168 | 168 | pycompat, |
|
169 | requirements, | |
|
169 | 170 | scmutil, |
|
170 | 171 | streamclone, |
|
171 | 172 | tags, |
|
172 | 173 | url, |
|
173 | 174 | util, |
|
174 | 175 | ) |
|
175 | from .interfaces import repository | |
|
176 | 176 | from .utils import stringutil |
|
177 | 177 | |
|
178 | 178 | urlerr = util.urlerr |
@@ -1966,7 +1966,7 b' def handlechangegroup(op, inpart):' | |||
|
1966 | 1966 | nbchangesets = int(inpart.params.get(b'nbchanges')) |
|
1967 | 1967 | if ( |
|
1968 | 1968 | b'treemanifest' in inpart.params |
|
1969 |
and re |
|
|
1969 | and requirements.TREEMANIFEST_REQUIREMENT not in op.repo.requirements | |
|
1970 | 1970 | ): |
|
1971 | 1971 | if len(op.repo.changelog) != 0: |
|
1972 | 1972 | raise error.Abort( |
@@ -1975,7 +1975,7 b' def handlechangegroup(op, inpart):' | |||
|
1975 | 1975 | b"non-empty and does not use tree manifests" |
|
1976 | 1976 | ) |
|
1977 | 1977 | ) |
|
1978 |
op.repo.requirements.add(re |
|
|
1978 | op.repo.requirements.add(requirements.TREEMANIFEST_REQUIREMENT) | |
|
1979 | 1979 | op.repo.svfs.options = localrepo.resolvestorevfsoptions( |
|
1980 | 1980 | op.repo.ui, op.repo.requirements, op.repo.features |
|
1981 | 1981 | ) |
@@ -2577,7 +2577,7 b' def widen_bundle(' | |||
|
2577 | 2577 | |
|
2578 | 2578 | part = bundler.newpart(b'changegroup', data=cgdata) |
|
2579 | 2579 | part.addparam(b'version', cgversion) |
|
2580 |
if re |
|
|
2580 | if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements: | |
|
2581 | 2581 | part.addparam(b'treemanifest', b'1') |
|
2582 | 2582 | if b'exp-sidedata-flag' in repo.requirements: |
|
2583 | 2583 | part.addparam(b'exp-sidedata', b'1') |
@@ -26,6 +26,7 b' from . import (' | |||
|
26 | 26 | mdiff, |
|
27 | 27 | phases, |
|
28 | 28 | pycompat, |
|
29 | requirements, | |
|
29 | 30 | util, |
|
30 | 31 | ) |
|
31 | 32 | |
@@ -949,7 +950,7 b' class cgpacker(object):' | |||
|
949 | 950 | # either, because we don't discover which directory nodes to |
|
950 | 951 | # send along with files. This could probably be fixed. |
|
951 | 952 | fastpathlinkrev = fastpathlinkrev and ( |
|
952 |
re |
|
|
953 | requirements.TREEMANIFEST_REQUIREMENT not in repo.requirements | |
|
953 | 954 | ) |
|
954 | 955 | |
|
955 | 956 | fnodes = {} # needed file nodes |
@@ -1467,7 +1468,7 b' def allsupportedversions(repo):' | |||
|
1467 | 1468 | if ( |
|
1468 | 1469 | repo.ui.configbool(b'experimental', b'changegroup3') |
|
1469 | 1470 | or repo.ui.configbool(b'experimental', b'treemanifest') |
|
1470 |
or re |
|
|
1471 | or requirements.TREEMANIFEST_REQUIREMENT in repo.requirements | |
|
1471 | 1472 | ): |
|
1472 | 1473 | # we keep version 03 because we need to to exchange treemanifest data |
|
1473 | 1474 | # |
@@ -1495,7 +1496,7 b' def supportedincomingversions(repo):' | |||
|
1495 | 1496 | # Changegroup versions that can be created from the repo |
|
1496 | 1497 | def supportedoutgoingversions(repo): |
|
1497 | 1498 | versions = allsupportedversions(repo) |
|
1498 |
if re |
|
|
1499 | if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements: | |
|
1499 | 1500 | # Versions 01 and 02 support only flat manifests and it's just too |
|
1500 | 1501 | # expensive to convert between the flat manifest and tree manifest on |
|
1501 | 1502 | # the fly. Since tree manifests are hashed differently, all of history |
@@ -1503,7 +1504,7 b' def supportedoutgoingversions(repo):' | |||
|
1503 | 1504 | # support versions 01 and 02. |
|
1504 | 1505 | versions.discard(b'01') |
|
1505 | 1506 | versions.discard(b'02') |
|
1506 |
if re |
|
|
1507 | if requirements.NARROW_REQUIREMENT in repo.requirements: | |
|
1507 | 1508 | # Versions 01 and 02 don't support revlog flags, and we need to |
|
1508 | 1509 | # support that for stripping and unbundling to work. |
|
1509 | 1510 | versions.discard(b'01') |
@@ -46,6 +46,7 b' from . import (' | |||
|
46 | 46 | phases, |
|
47 | 47 | pycompat, |
|
48 | 48 | repair, |
|
49 | requirements, | |
|
49 | 50 | revlog, |
|
50 | 51 | rewriteutil, |
|
51 | 52 | scmutil, |
@@ -58,8 +59,6 b' from . import (' | |||
|
58 | 59 | vfs as vfsmod, |
|
59 | 60 | ) |
|
60 | 61 | |
|
61 | from .interfaces import repository | |
|
62 | ||
|
63 | 62 | from .utils import ( |
|
64 | 63 | dateutil, |
|
65 | 64 | stringutil, |
@@ -1360,7 +1359,7 b' def openstorage(repo, cmd, file_, opts, ' | |||
|
1360 | 1359 | if cl: |
|
1361 | 1360 | r = repo.unfiltered().changelog |
|
1362 | 1361 | elif dir: |
|
1363 |
if re |
|
|
1362 | if requirements.TREEMANIFEST_REQUIREMENT not in repo.requirements: | |
|
1364 | 1363 | raise error.Abort( |
|
1365 | 1364 | _( |
|
1366 | 1365 | b"--dir can only be used on repos with " |
@@ -32,6 +32,7 b' from . import (' | |||
|
32 | 32 | phases, |
|
33 | 33 | pushkey, |
|
34 | 34 | pycompat, |
|
35 | requirements, | |
|
35 | 36 | scmutil, |
|
36 | 37 | sslutil, |
|
37 | 38 | streamclone, |
@@ -39,7 +40,6 b' from . import (' | |||
|
39 | 40 | util, |
|
40 | 41 | wireprototypes, |
|
41 | 42 | ) |
|
42 | from .interfaces import repository | |
|
43 | 43 | from .utils import ( |
|
44 | 44 | hashutil, |
|
45 | 45 | stringutil, |
@@ -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 re |
|
|
1071 | if requirements.TREEMANIFEST_REQUIREMENT in pushop.repo.requirements: | |
|
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') |
@@ -1691,7 +1691,7 b' def _fullpullbundle2(repo, pullop):' | |||
|
1691 | 1691 | old_heads = unficl.heads() |
|
1692 | 1692 | clstart = len(unficl) |
|
1693 | 1693 | _pullbundle2(pullop) |
|
1694 |
if re |
|
|
1694 | if requirements.NARROW_REQUIREMENT in repo.requirements: | |
|
1695 | 1695 | # XXX narrow clones filter the heads on the server side during |
|
1696 | 1696 | # XXX getbundle and result in partial replies as well. |
|
1697 | 1697 | # XXX Disable pull bundles in this case as band aid to avoid |
@@ -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 re |
|
|
2560 | if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements: | |
|
2561 | 2561 | part.addparam(b'treemanifest', b'1') |
|
2562 | 2562 | |
|
2563 | 2563 | if b'exp-sidedata-flag' in repo.requirements: |
@@ -38,6 +38,7 b' from . import (' | |||
|
38 | 38 | node, |
|
39 | 39 | phases, |
|
40 | 40 | pycompat, |
|
41 | requirements, | |
|
41 | 42 | scmutil, |
|
42 | 43 | sshpeer, |
|
43 | 44 | statichttprepo, |
@@ -49,7 +50,6 b' from . import (' | |||
|
49 | 50 | vfs as vfsmod, |
|
50 | 51 | ) |
|
51 | 52 | from .utils import hashutil |
|
52 | from .interfaces import repository as repositorymod | |
|
53 | 53 | |
|
54 | 54 | release = lock.release |
|
55 | 55 | |
@@ -388,7 +388,7 b' def postshare(sourcerepo, destrepo, defa' | |||
|
388 | 388 | if default: |
|
389 | 389 | template = b'[paths]\ndefault = %s\n' |
|
390 | 390 | destrepo.vfs.write(b'hgrc', util.tonativeeol(template % default)) |
|
391 |
if re |
|
|
391 | if requirements.NARROW_REQUIREMENT in sourcerepo.requirements: | |
|
392 | 392 | with destrepo.wlock(): |
|
393 | 393 | narrowspec.copytoworkingcopy(destrepo) |
|
394 | 394 |
@@ -11,20 +11,6 b' from ..i18n import _' | |||
|
11 | 11 | from .. import error |
|
12 | 12 | from . import util as interfaceutil |
|
13 | 13 | |
|
14 | # When narrowing is finalized and no longer subject to format changes, | |
|
15 | # we should move this to just "narrow" or similar. | |
|
16 | NARROW_REQUIREMENT = b'narrowhg-experimental' | |
|
17 | ||
|
18 | # Enables sparse working directory usage | |
|
19 | SPARSE_REQUIREMENT = b'exp-sparse' | |
|
20 | ||
|
21 | # Enables the internal phase which is used to hide changesets instead | |
|
22 | # of stripping them | |
|
23 | INTERNAL_PHASE_REQUIREMENT = b'internal-phase' | |
|
24 | ||
|
25 | # Stores manifest in Tree structure | |
|
26 | TREEMANIFEST_REQUIREMENT = b'treemanifest' | |
|
27 | ||
|
28 | 14 | # Local repository feature string. |
|
29 | 15 | |
|
30 | 16 | # Revlogs are being used for file storage. |
@@ -56,6 +56,7 b' from . import (' | |||
|
56 | 56 | pycompat, |
|
57 | 57 | rcutil, |
|
58 | 58 | repoview, |
|
59 | requirements as requirementsmod, | |
|
59 | 60 | revset, |
|
60 | 61 | revsetlang, |
|
61 | 62 | scmutil, |
@@ -816,7 +817,10 b' def ensurerequirementscompatible(ui, req' | |||
|
816 | 817 | |
|
817 | 818 | ``error.RepoError`` should be raised on failure. |
|
818 | 819 | """ |
|
819 | if repository.SPARSE_REQUIREMENT in requirements and not sparse.enabled: | |
|
820 | if ( | |
|
821 | requirementsmod.SPARSE_REQUIREMENT in requirements | |
|
822 | and not sparse.enabled | |
|
823 | ): | |
|
820 | 824 | raise error.RepoError( |
|
821 | 825 | _( |
|
822 | 826 | b'repository is using sparse feature but ' |
@@ -846,7 +850,7 b' def resolvestorevfsoptions(ui, requireme' | |||
|
846 | 850 | """ |
|
847 | 851 | options = {} |
|
848 | 852 | |
|
849 |
if re |
|
|
853 | if requirementsmod.TREEMANIFEST_REQUIREMENT in requirements: | |
|
850 | 854 | options[b'treemanifest'] = True |
|
851 | 855 | |
|
852 | 856 | # experimental config: format.manifestcachesize |
@@ -963,7 +967,7 b' def resolverevlogstorevfsoptions(ui, req' | |||
|
963 | 967 | msg = _(b'invalid value for `storage.revlog.zstd.level` config: %d') |
|
964 | 968 | raise error.Abort(msg % options[b'zstd.level']) |
|
965 | 969 | |
|
966 |
if re |
|
|
970 | if requirementsmod.NARROW_REQUIREMENT in requirements: | |
|
967 | 971 | options[b'enableellipsis'] = True |
|
968 | 972 | |
|
969 | 973 | if ui.configbool(b'experimental', b'rust.index'): |
@@ -1012,7 +1016,7 b' def makefilestorage(requirements, featur' | |||
|
1012 | 1016 | features.add(repository.REPO_FEATURE_REVLOG_FILE_STORAGE) |
|
1013 | 1017 | features.add(repository.REPO_FEATURE_STREAM_CLONE) |
|
1014 | 1018 | |
|
1015 |
if re |
|
|
1019 | if requirementsmod.NARROW_REQUIREMENT in requirements: | |
|
1016 | 1020 | return revlognarrowfilestorage |
|
1017 | 1021 | else: |
|
1018 | 1022 | return revlogfilestorage |
@@ -1053,7 +1057,7 b' class localrepository(object):' | |||
|
1053 | 1057 | supportedformats = { |
|
1054 | 1058 | b'revlogv1', |
|
1055 | 1059 | b'generaldelta', |
|
1056 |
re |
|
|
1060 | requirementsmod.TREEMANIFEST_REQUIREMENT, | |
|
1057 | 1061 | COPIESSDC_REQUIREMENT, |
|
1058 | 1062 | REVLOGV2_REQUIREMENT, |
|
1059 | 1063 | SIDEDATA_REQUIREMENT, |
@@ -1067,8 +1071,8 b' class localrepository(object):' | |||
|
1067 | 1071 | b'shared', |
|
1068 | 1072 | b'relshared', |
|
1069 | 1073 | b'dotencode', |
|
1070 |
re |
|
|
1071 |
re |
|
|
1074 | requirementsmod.SPARSE_REQUIREMENT, | |
|
1075 | requirementsmod.INTERNAL_PHASE_REQUIREMENT, | |
|
1072 | 1076 | } |
|
1073 | 1077 | |
|
1074 | 1078 | # list of prefix for file which can be written without 'wlock' |
@@ -1529,14 +1533,14 b' class localrepository(object):' | |||
|
1529 | 1533 | |
|
1530 | 1534 | @storecache(narrowspec.FILENAME) |
|
1531 | 1535 | def _storenarrowmatch(self): |
|
1532 |
if re |
|
|
1536 | if requirementsmod.NARROW_REQUIREMENT not in self.requirements: | |
|
1533 | 1537 | return matchmod.always() |
|
1534 | 1538 | include, exclude = self.narrowpats |
|
1535 | 1539 | return narrowspec.match(self.root, include=include, exclude=exclude) |
|
1536 | 1540 | |
|
1537 | 1541 | @storecache(narrowspec.FILENAME) |
|
1538 | 1542 | def _narrowmatch(self): |
|
1539 |
if re |
|
|
1543 | if requirementsmod.NARROW_REQUIREMENT not in self.requirements: | |
|
1540 | 1544 | return matchmod.always() |
|
1541 | 1545 | narrowspec.checkworkingcopynarrowspec(self) |
|
1542 | 1546 | include, exclude = self.narrowpats |
@@ -3314,7 +3318,7 b' def newreporequirements(ui, createopts):' | |||
|
3314 | 3318 | requirements.add(SIDEDATA_REQUIREMENT) |
|
3315 | 3319 | requirements.add(COPIESSDC_REQUIREMENT) |
|
3316 | 3320 | if ui.configbool(b'experimental', b'treemanifest'): |
|
3317 |
requirements.add(re |
|
|
3321 | requirements.add(requirementsmod.TREEMANIFEST_REQUIREMENT) | |
|
3318 | 3322 | |
|
3319 | 3323 | revlogv2 = ui.config(b'experimental', b'revlogv2') |
|
3320 | 3324 | if revlogv2 == b'enable-unstable-format-and-corrupt-my-data': |
@@ -3324,10 +3328,10 b' def newreporequirements(ui, createopts):' | |||
|
3324 | 3328 | requirements.add(REVLOGV2_REQUIREMENT) |
|
3325 | 3329 | # experimental config: format.internal-phase |
|
3326 | 3330 | if ui.configbool(b'format', b'internal-phase'): |
|
3327 |
requirements.add(re |
|
|
3331 | requirements.add(requirementsmod.INTERNAL_PHASE_REQUIREMENT) | |
|
3328 | 3332 | |
|
3329 | 3333 | if createopts.get(b'narrowfiles'): |
|
3330 |
requirements.add(re |
|
|
3334 | requirements.add(requirementsmod.NARROW_REQUIREMENT) | |
|
3331 | 3335 | |
|
3332 | 3336 | if createopts.get(b'lfs'): |
|
3333 | 3337 | requirements.add(b'lfs') |
@@ -9,12 +9,12 b' from __future__ import absolute_import' | |||
|
9 | 9 | |
|
10 | 10 | from .i18n import _ |
|
11 | 11 | from .pycompat import getattr |
|
12 | from .interfaces import repository | |
|
13 | 12 | from . import ( |
|
14 | 13 | error, |
|
15 | 14 | match as matchmod, |
|
16 | 15 | merge, |
|
17 | 16 | mergestate as mergestatemod, |
|
17 | requirements, | |
|
18 | 18 | scmutil, |
|
19 | 19 | sparse, |
|
20 | 20 | util, |
@@ -186,7 +186,7 b' def copytoworkingcopy(repo):' | |||
|
186 | 186 | |
|
187 | 187 | |
|
188 | 188 | def savebackup(repo, backupname): |
|
189 |
if re |
|
|
189 | if requirements.NARROW_REQUIREMENT not in repo.requirements: | |
|
190 | 190 | return |
|
191 | 191 | svfs = repo.svfs |
|
192 | 192 | svfs.tryunlink(backupname) |
@@ -194,13 +194,13 b' def savebackup(repo, backupname):' | |||
|
194 | 194 | |
|
195 | 195 | |
|
196 | 196 | def restorebackup(repo, backupname): |
|
197 |
if re |
|
|
197 | if requirements.NARROW_REQUIREMENT not in repo.requirements: | |
|
198 | 198 | return |
|
199 | 199 | util.rename(repo.svfs.join(backupname), repo.svfs.join(FILENAME)) |
|
200 | 200 | |
|
201 | 201 | |
|
202 | 202 | def savewcbackup(repo, backupname): |
|
203 |
if re |
|
|
203 | if requirements.NARROW_REQUIREMENT not in repo.requirements: | |
|
204 | 204 | return |
|
205 | 205 | vfs = repo.vfs |
|
206 | 206 | vfs.tryunlink(backupname) |
@@ -212,7 +212,7 b' def savewcbackup(repo, backupname):' | |||
|
212 | 212 | |
|
213 | 213 | |
|
214 | 214 | def restorewcbackup(repo, backupname): |
|
215 |
if re |
|
|
215 | if requirements.NARROW_REQUIREMENT not in repo.requirements: | |
|
216 | 216 | return |
|
217 | 217 | # It may not exist in old repos |
|
218 | 218 | if repo.vfs.exists(backupname): |
@@ -220,7 +220,7 b' def restorewcbackup(repo, backupname):' | |||
|
220 | 220 | |
|
221 | 221 | |
|
222 | 222 | def clearwcbackup(repo, backupname): |
|
223 |
if re |
|
|
223 | if requirements.NARROW_REQUIREMENT not in repo.requirements: | |
|
224 | 224 | return |
|
225 | 225 | repo.vfs.tryunlink(backupname) |
|
226 | 226 |
@@ -121,11 +121,11 b' from .pycompat import (' | |||
|
121 | 121 | from . import ( |
|
122 | 122 | error, |
|
123 | 123 | pycompat, |
|
124 | requirements, | |
|
124 | 125 | smartset, |
|
125 | 126 | txnutil, |
|
126 | 127 | util, |
|
127 | 128 | ) |
|
128 | from .interfaces import repository | |
|
129 | 129 | |
|
130 | 130 | _fphasesentry = struct.Struct(b'>i20s') |
|
131 | 131 | |
@@ -155,7 +155,7 b' localhiddenphases = (internal, archived)' | |||
|
155 | 155 | |
|
156 | 156 | def supportinternal(repo): |
|
157 | 157 | """True if the internal phase can be used on a repository""" |
|
158 |
return re |
|
|
158 | return requirements.INTERNAL_PHASE_REQUIREMENT in repo.requirements | |
|
159 | 159 | |
|
160 | 160 | |
|
161 | 161 | def _readroots(repo, phasedefaults=None): |
@@ -26,9 +26,9 b' from . import (' | |||
|
26 | 26 | pathutil, |
|
27 | 27 | phases, |
|
28 | 28 | pycompat, |
|
29 | requirements, | |
|
29 | 30 | util, |
|
30 | 31 | ) |
|
31 | from .interfaces import repository | |
|
32 | 32 | from .utils import ( |
|
33 | 33 | hashutil, |
|
34 | 34 | stringutil, |
@@ -419,7 +419,7 b' def stripmanifest(repo, striprev, tr, fi' | |||
|
419 | 419 | |
|
420 | 420 | def manifestrevlogs(repo): |
|
421 | 421 | yield repo.manifestlog.getstorage(b'') |
|
422 |
if re |
|
|
422 | if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements: | |
|
423 | 423 | # This logic is safe if treemanifest isn't enabled, but also |
|
424 | 424 | # pointless, so we skip it if treemanifest isn't enabled. |
|
425 | 425 | for unencoded, encoded, size in repo.store.datafiles(): |
@@ -477,7 +477,7 b' def rebuildfncache(ui, repo):' | |||
|
477 | 477 | |
|
478 | 478 | progress.complete() |
|
479 | 479 | |
|
480 |
if re |
|
|
480 | if requirements.TREEMANIFEST_REQUIREMENT in repo.requirements: | |
|
481 | 481 | # This logic is safe if treemanifest isn't enabled, but also |
|
482 | 482 | # pointless, so we skip it if treemanifest isn't enabled. |
|
483 | 483 | for dir in pathutil.dirs(seenfiles): |
@@ -21,10 +21,10 b' from . import (' | |||
|
21 | 21 | mergestate as mergestatemod, |
|
22 | 22 | pathutil, |
|
23 | 23 | pycompat, |
|
24 | requirements, | |
|
24 | 25 | scmutil, |
|
25 | 26 | util, |
|
26 | 27 | ) |
|
27 | from .interfaces import repository | |
|
28 | 28 | from .utils import hashutil |
|
29 | 29 | |
|
30 | 30 | |
@@ -608,11 +608,11 b' def _updateconfigandrefreshwdir(' | |||
|
608 | 608 | # updated. But this requires massive rework to matcher() and its |
|
609 | 609 | # consumers. |
|
610 | 610 | |
|
611 |
if re |
|
|
612 |
repo.requirements.discard(re |
|
|
611 | if requirements.SPARSE_REQUIREMENT in oldrequires and removing: | |
|
612 | repo.requirements.discard(requirements.SPARSE_REQUIREMENT) | |
|
613 | 613 | scmutil.writereporequirements(repo) |
|
614 |
elif re |
|
|
615 |
repo.requirements.add(re |
|
|
614 | elif requirements.SPARSE_REQUIREMENT not in oldrequires: | |
|
615 | repo.requirements.add(requirements.SPARSE_REQUIREMENT) | |
|
616 | 616 | scmutil.writereporequirements(repo) |
|
617 | 617 | |
|
618 | 618 | try: |
@@ -20,13 +20,13 b' from . import (' | |||
|
20 | 20 | manifest, |
|
21 | 21 | metadata, |
|
22 | 22 | pycompat, |
|
23 | requirements, | |
|
23 | 24 | revlog, |
|
24 | 25 | scmutil, |
|
25 | 26 | util, |
|
26 | 27 | vfs as vfsmod, |
|
27 | 28 | ) |
|
28 | 29 | |
|
29 | from .interfaces import repository | |
|
30 | 30 | from .utils import compression |
|
31 | 31 | |
|
32 | 32 | # list of requirements that request a clone of all revlog if added/removed |
@@ -59,7 +59,7 b' def blocksourcerequirements(repo):' | |||
|
59 | 59 | return { |
|
60 | 60 | # The upgrade code does not yet support these experimental features. |
|
61 | 61 | # This is an artificial limitation. |
|
62 |
re |
|
|
62 | requirements.TREEMANIFEST_REQUIREMENT, | |
|
63 | 63 | # This was a precursor to generaldelta and was never enabled by default. |
|
64 | 64 | # It should (hopefully) not exist in the wild. |
|
65 | 65 | b'parentdelta', |
@@ -13,8 +13,8 b' from mercurial import (' | |||
|
13 | 13 | error, |
|
14 | 14 | extensions, |
|
15 | 15 | localrepo, |
|
16 | requirements, | |
|
16 | 17 | ) |
|
17 | from mercurial.interfaces import repository | |
|
18 | 18 | |
|
19 | 19 | |
|
20 | 20 | def clonecommand(orig, ui, repo, *args, **kwargs): |
@@ -31,7 +31,7 b' def clonecommand(orig, ui, repo, *args, ' | |||
|
31 | 31 | |
|
32 | 32 | |
|
33 | 33 | def featuresetup(ui, features): |
|
34 |
features.add(re |
|
|
34 | features.add(requirements.NARROW_REQUIREMENT) | |
|
35 | 35 | |
|
36 | 36 | |
|
37 | 37 | def extsetup(ui): |
General Comments 0
You need to be logged in to leave comments.
Login now