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