Show More
@@ -15,6 +15,7 from __future__ import absolute_import | |||
|
15 | 15 | testedwith = 'ships-with-hg-core' |
|
16 | 16 | |
|
17 | 17 | from mercurial import ( |
|
18 | changegroup, | |
|
18 | 19 | extensions, |
|
19 | 20 | hg, |
|
20 | 21 | localrepo, |
@@ -55,7 +56,7 configitem('experimental', 'narrowserveb | |||
|
55 | 56 | # Export the commands table for Mercurial to see. |
|
56 | 57 | cmdtable = narrowcommands.table |
|
57 | 58 | |
|
58 |
localrepo.localrepository._basesupported.add( |
|
|
59 | localrepo.localrepository._basesupported.add(changegroup.NARROW_REQUIREMENT) | |
|
59 | 60 | |
|
60 | 61 | def uisetup(ui): |
|
61 | 62 | """Wraps user-facing mercurial commands with narrow-aware versions.""" |
@@ -71,7 +72,7 def reposetup(ui, repo): | |||
|
71 | 72 | if not isinstance(repo, localrepo.localrepository): |
|
72 | 73 | return |
|
73 | 74 | |
|
74 |
if |
|
|
75 | if changegroup.NARROW_REQUIREMENT in repo.requirements: | |
|
75 | 76 | narrowrepo.wraprepo(repo, True) |
|
76 | 77 | narrowcopies.setup(repo) |
|
77 | 78 | narrowdirstate.setup(repo) |
@@ -30,10 +30,6 from mercurial import ( | |||
|
30 | 30 | wireproto, |
|
31 | 31 | ) |
|
32 | 32 | |
|
33 | from . import ( | |
|
34 | narrowrepo, | |
|
35 | ) | |
|
36 | ||
|
37 | 33 | NARROWCAP = 'narrow' |
|
38 | 34 | _NARROWACL_SECTION = 'narrowhgacl' |
|
39 | 35 | _CHANGESPECPART = NARROWCAP + ':changespec' |
@@ -366,8 +362,8 def _handlechangespec_2(op, inpart): | |||
|
366 | 362 | includepats = set(inpart.params.get(_SPECPART_INCLUDE, '').splitlines()) |
|
367 | 363 | excludepats = set(inpart.params.get(_SPECPART_EXCLUDE, '').splitlines()) |
|
368 | 364 | narrowspec.save(op.repo, includepats, excludepats) |
|
369 |
if not |
|
|
370 |
op.repo.requirements.add( |
|
|
365 | if not changegroup.NARROW_REQUIREMENT in op.repo.requirements: | |
|
366 | op.repo.requirements.add(changegroup.NARROW_REQUIREMENT) | |
|
371 | 367 | op.repo._writerequirements() |
|
372 | 368 | op.repo.invalidate(clearfilecache=True) |
|
373 | 369 |
@@ -19,15 +19,11 from mercurial import ( | |||
|
19 | 19 | util, |
|
20 | 20 | ) |
|
21 | 21 | |
|
22 | from . import ( | |
|
23 | narrowrepo, | |
|
24 | ) | |
|
25 | ||
|
26 | 22 | def setup(): |
|
27 | 23 | |
|
28 | 24 | def supportedoutgoingversions(orig, repo): |
|
29 | 25 | versions = orig(repo) |
|
30 |
if |
|
|
26 | if changegroup.NARROW_REQUIREMENT in repo.requirements: | |
|
31 | 27 | versions.discard('01') |
|
32 | 28 | versions.discard('02') |
|
33 | 29 | return versions |
@@ -10,6 +10,7 import itertools | |||
|
10 | 10 | |
|
11 | 11 | from mercurial.i18n import _ |
|
12 | 12 | from mercurial import ( |
|
13 | changegroup, | |
|
13 | 14 | cmdutil, |
|
14 | 15 | commands, |
|
15 | 16 | discovery, |
@@ -105,7 +106,7 def clonenarrowcmd(orig, ui, repo, *args | |||
|
105 | 106 | repo.__class__.__bases__ = (repo.__class__.__bases__[0], |
|
106 | 107 | repo.unfiltered().__class__) |
|
107 | 108 | if opts_narrow: |
|
108 |
repo.requirements.add( |
|
|
109 | repo.requirements.add(changegroup.NARROW_REQUIREMENT) | |
|
109 | 110 | repo._writerequirements() |
|
110 | 111 | |
|
111 | 112 | return orig(repo, *args, **kwargs) |
@@ -118,7 +119,7 def clonenarrowcmd(orig, ui, repo, *args | |||
|
118 | 119 | def pullnarrowcmd(orig, ui, repo, *args, **opts): |
|
119 | 120 | """Wraps pull command to allow modifying narrow spec.""" |
|
120 | 121 | wrappedextraprepare = util.nullcontextmanager() |
|
121 |
if |
|
|
122 | if changegroup.NARROW_REQUIREMENT in repo.requirements: | |
|
122 | 123 | |
|
123 | 124 | def pullbundle2extraprepare_widen(orig, pullop, kwargs): |
|
124 | 125 | orig(pullop, kwargs) |
@@ -132,7 +133,7 def pullnarrowcmd(orig, ui, repo, *args, | |||
|
132 | 133 | |
|
133 | 134 | def archivenarrowcmd(orig, ui, repo, *args, **opts): |
|
134 | 135 | """Wraps archive command to narrow the default includes.""" |
|
135 |
if |
|
|
136 | if changegroup.NARROW_REQUIREMENT in repo.requirements: | |
|
136 | 137 | repo_includes, repo_excludes = repo.narrowpats |
|
137 | 138 | includes = set(opts.get(r'include', [])) |
|
138 | 139 | excludes = set(opts.get(r'exclude', [])) |
@@ -146,7 +147,7 def archivenarrowcmd(orig, ui, repo, *ar | |||
|
146 | 147 | |
|
147 | 148 | def pullbundle2extraprepare(orig, pullop, kwargs): |
|
148 | 149 | repo = pullop.repo |
|
149 |
if |
|
|
150 | if changegroup.NARROW_REQUIREMENT not in repo.requirements: | |
|
150 | 151 | return orig(pullop, kwargs) |
|
151 | 152 | |
|
152 | 153 | if narrowbundle2.NARROWCAP not in pullop.remotebundle2caps: |
@@ -333,7 +334,7 def trackedcmd(ui, repo, remotepath=None | |||
|
333 | 334 | empty and will not match any files. |
|
334 | 335 | """ |
|
335 | 336 | opts = pycompat.byteskwargs(opts) |
|
336 |
if |
|
|
337 | if changegroup.NARROW_REQUIREMENT not in repo.requirements: | |
|
337 | 338 | ui.warn(_('The narrow command is only supported on respositories cloned' |
|
338 | 339 | ' with --narrow.\n')) |
|
339 | 340 | return 1 |
@@ -9,6 +9,7 from __future__ import absolute_import | |||
|
9 | 9 | |
|
10 | 10 | from mercurial import ( |
|
11 | 11 | bundlerepo, |
|
12 | changegroup, | |
|
12 | 13 | hg, |
|
13 | 14 | localrepo, |
|
14 | 15 | match as matchmod, |
@@ -20,19 +21,15 from . import ( | |||
|
20 | 21 | narrowrevlog, |
|
21 | 22 | ) |
|
22 | 23 | |
|
23 | # When narrowing is finalized and no longer subject to format changes, | |
|
24 | # we should move this to just "narrow" or similar. | |
|
25 | REQUIREMENT = 'narrowhg-experimental' | |
|
26 | ||
|
27 | 24 | def wrappostshare(orig, sourcerepo, destrepo, **kwargs): |
|
28 | 25 | orig(sourcerepo, destrepo, **kwargs) |
|
29 | if REQUIREMENT in sourcerepo.requirements: | |
|
26 | if changegroup.NARROW_REQUIREMENT in sourcerepo.requirements: | |
|
30 | 27 | with destrepo.wlock(): |
|
31 | 28 | with destrepo.vfs('shared', 'a') as fp: |
|
32 | 29 | fp.write(narrowspec.FILENAME + '\n') |
|
33 | 30 | |
|
34 | 31 | def unsharenarrowspec(orig, ui, repo, repopath): |
|
35 | if (REQUIREMENT in repo.requirements | |
|
32 | if (changegroup.NARROW_REQUIREMENT in repo.requirements | |
|
36 | 33 | and repo.path == repopath and repo.shared()): |
|
37 | 34 | srcrepo = hg.sharedreposource(repo) |
|
38 | 35 | with srcrepo.vfs(narrowspec.FILENAME) as f: |
@@ -32,6 +32,10 from . import ( | |||
|
32 | 32 | _CHANGEGROUPV2_DELTA_HEADER = "20s20s20s20s20s" |
|
33 | 33 | _CHANGEGROUPV3_DELTA_HEADER = ">20s20s20s20s20sH" |
|
34 | 34 | |
|
35 | # When narrowing is finalized and no longer subject to format changes, | |
|
36 | # we should move this to just "narrow" or similar. | |
|
37 | NARROW_REQUIREMENT = 'narrowhg-experimental' | |
|
38 | ||
|
35 | 39 | readexactly = util.readexactly |
|
36 | 40 | |
|
37 | 41 | def getchunk(stream): |
General Comments 0
You need to be logged in to leave comments.
Login now