Show More
@@ -15,11 +15,11 b' from __future__ import absolute_import' | |||
|
15 | 15 | testedwith = 'ships-with-hg-core' |
|
16 | 16 | |
|
17 | 17 | from mercurial import ( |
|
18 | changegroup, | |
|
19 | 18 | extensions, |
|
20 | 19 | hg, |
|
21 | 20 | localrepo, |
|
22 | 21 | registrar, |
|
22 | repository, | |
|
23 | 23 | verify as verifymod, |
|
24 | 24 | ) |
|
25 | 25 | |
@@ -55,7 +55,7 b" configitem('experimental', 'narrowserveb" | |||
|
55 | 55 | cmdtable = narrowcommands.table |
|
56 | 56 | |
|
57 | 57 | def featuresetup(ui, features): |
|
58 |
features.add( |
|
|
58 | features.add(repository.NARROW_REQUIREMENT) | |
|
59 | 59 | |
|
60 | 60 | def uisetup(ui): |
|
61 | 61 | """Wraps user-facing mercurial commands with narrow-aware versions.""" |
@@ -71,7 +71,7 b' def reposetup(ui, repo):' | |||
|
71 | 71 | if not repo.local(): |
|
72 | 72 | return |
|
73 | 73 | |
|
74 |
if |
|
|
74 | if repository.NARROW_REQUIREMENT in repo.requirements: | |
|
75 | 75 | narrowrepo.wraprepo(repo) |
|
76 | 76 | narrowcopies.setup(repo) |
|
77 | 77 | narrowpatch.setup(repo) |
@@ -23,6 +23,7 b' from mercurial import (' | |||
|
23 | 23 | extensions, |
|
24 | 24 | narrowspec, |
|
25 | 25 | repair, |
|
26 | repository, | |
|
26 | 27 | util, |
|
27 | 28 | wireprototypes, |
|
28 | 29 | ) |
@@ -174,8 +175,8 b' def getbundlechangegrouppart_narrow(bund' | |||
|
174 | 175 | def _handlechangespec_2(op, inpart): |
|
175 | 176 | includepats = set(inpart.params.get(_SPECPART_INCLUDE, '').splitlines()) |
|
176 | 177 | excludepats = set(inpart.params.get(_SPECPART_EXCLUDE, '').splitlines()) |
|
177 |
if not |
|
|
178 |
op.repo.requirements.add( |
|
|
178 | if not repository.NARROW_REQUIREMENT in op.repo.requirements: | |
|
179 | op.repo.requirements.add(repository.NARROW_REQUIREMENT) | |
|
179 | 180 | op.repo._writerequirements() |
|
180 | 181 | op.repo.setnarrowpats(includepats, excludepats) |
|
181 | 182 |
@@ -10,7 +10,6 b' import itertools' | |||
|
10 | 10 | |
|
11 | 11 | from mercurial.i18n import _ |
|
12 | 12 | from mercurial import ( |
|
13 | changegroup, | |
|
14 | 13 | cmdutil, |
|
15 | 14 | commands, |
|
16 | 15 | discovery, |
@@ -24,6 +23,7 b' from mercurial import (' | |||
|
24 | 23 | pycompat, |
|
25 | 24 | registrar, |
|
26 | 25 | repair, |
|
26 | repository, | |
|
27 | 27 | repoview, |
|
28 | 28 | util, |
|
29 | 29 | ) |
@@ -101,7 +101,7 b' def clonenarrowcmd(orig, ui, repo, *args' | |||
|
101 | 101 | |
|
102 | 102 | def pullnarrow(orig, repo, *args, **kwargs): |
|
103 | 103 | if opts_narrow: |
|
104 |
repo.requirements.add( |
|
|
104 | repo.requirements.add(repository.NARROW_REQUIREMENT) | |
|
105 | 105 | repo._writerequirements() |
|
106 | 106 | |
|
107 | 107 | return orig(repo, *args, **kwargs) |
@@ -114,7 +114,7 b' def clonenarrowcmd(orig, ui, repo, *args' | |||
|
114 | 114 | def pullnarrowcmd(orig, ui, repo, *args, **opts): |
|
115 | 115 | """Wraps pull command to allow modifying narrow spec.""" |
|
116 | 116 | wrappedextraprepare = util.nullcontextmanager() |
|
117 |
if |
|
|
117 | if repository.NARROW_REQUIREMENT in repo.requirements: | |
|
118 | 118 | |
|
119 | 119 | def pullbundle2extraprepare_widen(orig, pullop, kwargs): |
|
120 | 120 | orig(pullop, kwargs) |
@@ -128,7 +128,7 b' def pullnarrowcmd(orig, ui, repo, *args,' | |||
|
128 | 128 | |
|
129 | 129 | def archivenarrowcmd(orig, ui, repo, *args, **opts): |
|
130 | 130 | """Wraps archive command to narrow the default includes.""" |
|
131 |
if |
|
|
131 | if repository.NARROW_REQUIREMENT in repo.requirements: | |
|
132 | 132 | repo_includes, repo_excludes = repo.narrowpats |
|
133 | 133 | includes = set(opts.get(r'include', [])) |
|
134 | 134 | excludes = set(opts.get(r'exclude', [])) |
@@ -142,7 +142,7 b' def archivenarrowcmd(orig, ui, repo, *ar' | |||
|
142 | 142 | |
|
143 | 143 | def pullbundle2extraprepare(orig, pullop, kwargs): |
|
144 | 144 | repo = pullop.repo |
|
145 |
if |
|
|
145 | if repository.NARROW_REQUIREMENT not in repo.requirements: | |
|
146 | 146 | return orig(pullop, kwargs) |
|
147 | 147 | |
|
148 | 148 | if narrowbundle2.NARROWCAP not in pullop.remotebundle2caps: |
@@ -331,7 +331,7 b' def trackedcmd(ui, repo, remotepath=None' | |||
|
331 | 331 | empty and will not match any files. |
|
332 | 332 | """ |
|
333 | 333 | opts = pycompat.byteskwargs(opts) |
|
334 |
if |
|
|
334 | if repository.NARROW_REQUIREMENT not in repo.requirements: | |
|
335 | 335 | ui.warn(_('The narrow command is only supported on respositories cloned' |
|
336 | 336 | ' with --narrow.\n')) |
|
337 | 337 | return 1 |
@@ -8,9 +8,9 b'' | |||
|
8 | 8 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | 10 | from mercurial import ( |
|
11 | changegroup, | |
|
12 | 11 | hg, |
|
13 | 12 | narrowspec, |
|
13 | repository, | |
|
14 | 14 | ) |
|
15 | 15 | |
|
16 | 16 | from . import ( |
@@ -20,13 +20,13 b' from . import (' | |||
|
20 | 20 | |
|
21 | 21 | def wrappostshare(orig, sourcerepo, destrepo, **kwargs): |
|
22 | 22 | orig(sourcerepo, destrepo, **kwargs) |
|
23 |
if |
|
|
23 | if repository.NARROW_REQUIREMENT in sourcerepo.requirements: | |
|
24 | 24 | with destrepo.wlock(): |
|
25 | 25 | with destrepo.vfs('shared', 'a') as fp: |
|
26 | 26 | fp.write(narrowspec.FILENAME + '\n') |
|
27 | 27 | |
|
28 | 28 | def unsharenarrowspec(orig, ui, repo, repopath): |
|
29 |
if ( |
|
|
29 | if (repository.NARROW_REQUIREMENT in repo.requirements | |
|
30 | 30 | and repo.path == repopath and repo.shared()): |
|
31 | 31 | srcrepo = hg.sharedreposource(repo) |
|
32 | 32 | with srcrepo.vfs(narrowspec.FILENAME) as f: |
@@ -26,6 +26,7 b' from . import (' | |||
|
26 | 26 | mdiff, |
|
27 | 27 | phases, |
|
28 | 28 | pycompat, |
|
29 | repository, | |
|
29 | 30 | util, |
|
30 | 31 | ) |
|
31 | 32 | |
@@ -39,10 +40,6 b' from .utils import (' | |||
|
39 | 40 | |
|
40 | 41 | LFS_REQUIREMENT = 'lfs' |
|
41 | 42 | |
|
42 | # When narrowing is finalized and no longer subject to format changes, | |
|
43 | # we should move this to just "narrow" or similar. | |
|
44 | NARROW_REQUIREMENT = 'narrowhg-experimental' | |
|
45 | ||
|
46 | 43 | readexactly = util.readexactly |
|
47 | 44 | |
|
48 | 45 | def getchunk(stream): |
@@ -914,7 +911,7 b' def supportedoutgoingversions(repo):' | |||
|
914 | 911 | # support versions 01 and 02. |
|
915 | 912 | versions.discard('01') |
|
916 | 913 | versions.discard('02') |
|
917 | if NARROW_REQUIREMENT in repo.requirements: | |
|
914 | if repository.NARROW_REQUIREMENT in repo.requirements: | |
|
918 | 915 | # Versions 01 and 02 don't support revlog flags, and we need to |
|
919 | 916 | # support that for stripping and unbundling to work. |
|
920 | 917 | versions.discard('01') |
@@ -34,6 +34,7 b' from . import (' | |||
|
34 | 34 | phases, |
|
35 | 35 | pushkey, |
|
36 | 36 | pycompat, |
|
37 | repository, | |
|
37 | 38 | scmutil, |
|
38 | 39 | sslutil, |
|
39 | 40 | streamclone, |
@@ -1432,7 +1433,7 b' def _fullpullbundle2(repo, pullop):' | |||
|
1432 | 1433 | old_heads = unficl.heads() |
|
1433 | 1434 | clstart = len(unficl) |
|
1434 | 1435 | _pullbundle2(pullop) |
|
1435 |
if |
|
|
1436 | if repository.NARROW_REQUIREMENT in repo.requirements: | |
|
1436 | 1437 | # XXX narrow clones filter the heads on the server side during |
|
1437 | 1438 | # XXX getbundle and result in partial replies as well. |
|
1438 | 1439 | # XXX Disable pull bundles in this case as band aid to avoid |
@@ -825,7 +825,7 b' class localrepository(object):' | |||
|
825 | 825 | |
|
826 | 826 | @repofilecache(narrowspec.FILENAME) |
|
827 | 827 | def _narrowmatch(self): |
|
828 |
if |
|
|
828 | if repository.NARROW_REQUIREMENT not in self.requirements: | |
|
829 | 829 | return matchmod.always(self.root, '') |
|
830 | 830 | include, exclude = self.narrowpats |
|
831 | 831 | return narrowspec.match(self.root, include=include, exclude=exclude) |
@@ -15,6 +15,10 b' from .utils import (' | |||
|
15 | 15 | interfaceutil, |
|
16 | 16 | ) |
|
17 | 17 | |
|
18 | # When narrowing is finalized and no longer subject to format changes, | |
|
19 | # we should move this to just "narrow" or similar. | |
|
20 | NARROW_REQUIREMENT = 'narrowhg-experimental' | |
|
21 | ||
|
18 | 22 | class ipeerconnection(interfaceutil.Interface): |
|
19 | 23 | """Represents a "connection" to a repository. |
|
20 | 24 |
General Comments 0
You need to be logged in to leave comments.
Login now