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