Show More
@@ -84,8 +84,7 b' def _verifierinit(orig, self, repo, matc' | |||||
84 | # be None from core. If another extension passes a matcher (unlikely), |
|
84 | # be None from core. If another extension passes a matcher (unlikely), | |
85 | # we'll have to fail until matchers can be composed more easily. |
|
85 | # we'll have to fail until matchers can be composed more easily. | |
86 | assert matcher is None |
|
86 | assert matcher is None | |
87 | matcher = getattr(repo, 'narrowmatch', lambda: None)() |
|
87 | orig(self, repo, repo.narrowmatch()) | |
88 | orig(self, repo, matcher) |
|
|||
89 |
|
88 | |||
90 | def extsetup(ui): |
|
89 | def extsetup(ui): | |
91 | extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit) |
|
90 | extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit) |
@@ -23,12 +23,12 b' from mercurial import (' | |||||
23 | def setup(): |
|
23 | def setup(): | |
24 |
|
24 | |||
25 | def _cgmatcher(cgpacker): |
|
25 | def _cgmatcher(cgpacker): | |
26 |
localmatcher = |
|
26 | localmatcher = cgpacker._repo.narrowmatch() | |
27 | remotematcher = getattr(cgpacker, '_narrow_matcher', lambda: None)() |
|
27 | remotematcher = getattr(cgpacker, '_narrow_matcher', lambda: None)() | |
28 |
if |
|
28 | if remotematcher: | |
29 | return matchmod.intersectmatchers(localmatcher, remotematcher) |
|
29 | return matchmod.intersectmatchers(localmatcher, remotematcher) | |
30 | else: |
|
30 | else: | |
31 |
return localmatcher |
|
31 | return localmatcher | |
32 |
|
32 | |||
33 | def prune(orig, self, revlog, missing, commonrevs): |
|
33 | def prune(orig, self, revlog, missing, commonrevs): | |
34 | if isinstance(revlog, manifest.manifestrevlog): |
|
34 | if isinstance(revlog, manifest.manifestrevlog): |
@@ -11,23 +11,22 b' from __future__ import absolute_import' | |||||
11 | from mercurial import ( |
|
11 | from mercurial import ( | |
12 | copies, |
|
12 | copies, | |
13 | extensions, |
|
13 | extensions, | |
14 | util, |
|
|||
15 | ) |
|
14 | ) | |
16 |
|
15 | |||
17 | def setup(repo): |
|
16 | def setup(repo): | |
18 | def _computeforwardmissing(orig, a, b, match=None): |
|
17 | def _computeforwardmissing(orig, a, b, match=None): | |
19 | missing = orig(a, b, match) |
|
18 | missing = orig(a, b, match) | |
20 | if util.safehasattr(repo, 'narrowmatch'): |
|
19 | narrowmatch = repo.narrowmatch() | |
21 |
|
|
20 | if narrowmatch.always(): | |
22 | missing = [f for f in missing if narrowmatch(f)] |
|
21 | return missing | |
|
22 | missing = [f for f in missing if narrowmatch(f)] | |||
23 | return missing |
|
23 | return missing | |
24 |
|
24 | |||
25 | def _checkcopies(orig, srcctx, dstctx, f, base, tca, remotebase, limit, |
|
25 | def _checkcopies(orig, srcctx, dstctx, f, base, tca, remotebase, limit, | |
26 | data): |
|
26 | data): | |
27 | if util.safehasattr(repo, 'narrowmatch'): |
|
27 | narrowmatch = repo.narrowmatch() | |
28 |
|
|
28 | if not narrowmatch(f): | |
29 | if not narrowmatch(f): |
|
29 | return | |
30 | return |
|
|||
31 | orig(srcctx, dstctx, f, base, tca, remotebase, limit, data) |
|
30 | orig(srcctx, dstctx, f, base, tca, remotebase, limit, data) | |
32 |
|
31 | |||
33 | extensions.wrapfunction(copies, '_computeforwardmissing', |
|
32 | extensions.wrapfunction(copies, '_computeforwardmissing', |
@@ -13,7 +13,6 b' from mercurial import (' | |||||
13 | error, |
|
13 | error, | |
14 | extensions, |
|
14 | extensions, | |
15 | merge, |
|
15 | merge, | |
16 | util, |
|
|||
17 | ) |
|
16 | ) | |
18 |
|
17 | |||
19 | def setup(): |
|
18 | def setup(): | |
@@ -22,12 +21,12 b' def setup():' | |||||
22 | actions, diverge, renamedelete = orig( |
|
21 | actions, diverge, renamedelete = orig( | |
23 | repo, wctx, p2, pa, branchmerge, *args, **kwargs) |
|
22 | repo, wctx, p2, pa, branchmerge, *args, **kwargs) | |
24 |
|
23 | |||
25 | if not util.safehasattr(repo, 'narrowmatch'): |
|
24 | narrowmatch = repo.narrowmatch() | |
|
25 | if narrowmatch.always(): | |||
26 | return actions, diverge, renamedelete |
|
26 | return actions, diverge, renamedelete | |
27 |
|
27 | |||
28 | nooptypes = set(['k']) # TODO: handle with nonconflicttypes |
|
28 | nooptypes = set(['k']) # TODO: handle with nonconflicttypes | |
29 | nonconflicttypes = set('a am c cm f g r e'.split()) |
|
29 | nonconflicttypes = set('a am c cm f g r e'.split()) | |
30 | narrowmatch = repo.narrowmatch() |
|
|||
31 | # We mutate the items in the dict during iteration, so iterate |
|
30 | # We mutate the items in the dict during iteration, so iterate | |
32 | # over a copy. |
|
31 | # over a copy. | |
33 | for f, action in list(actions.items()): |
|
32 | for f, action in list(actions.items()): | |
@@ -51,8 +50,8 b' def setup():' | |||||
51 | extensions.wrapfunction(merge, 'manifestmerge', _manifestmerge) |
|
50 | extensions.wrapfunction(merge, 'manifestmerge', _manifestmerge) | |
52 |
|
51 | |||
53 | def _checkcollision(orig, repo, wmf, actions): |
|
52 | def _checkcollision(orig, repo, wmf, actions): | |
54 | if util.safehasattr(repo, 'narrowmatch'): |
|
53 | narrowmatch = repo.narrowmatch() | |
55 |
|
|
54 | if not narrowmatch.always(): | |
56 | wmf = wmf.matches(narrowmatch) |
|
55 | wmf = wmf.matches(narrowmatch) | |
57 | if actions: |
|
56 | if actions: | |
58 | narrowactions = {} |
|
57 | narrowactions = {} | |
@@ -68,10 +67,10 b' def setup():' | |||||
68 |
|
67 | |||
69 | def _computenonoverlap(orig, repo, *args, **kwargs): |
|
68 | def _computenonoverlap(orig, repo, *args, **kwargs): | |
70 | u1, u2 = orig(repo, *args, **kwargs) |
|
69 | u1, u2 = orig(repo, *args, **kwargs) | |
71 | if not util.safehasattr(repo, 'narrowmatch'): |
|
70 | narrowmatch = repo.narrowmatch() | |
|
71 | if narrowmatch.always(): | |||
72 | return u1, u2 |
|
72 | return u1, u2 | |
73 |
|
73 | |||
74 | narrowmatch = repo.narrowmatch() |
|
|||
75 | u1 = [f for f in u1 if narrowmatch(f)] |
|
74 | u1 = [f for f in u1 if narrowmatch(f)] | |
76 | u2 = [f for f in u2 if narrowmatch(f)] |
|
75 | u2 = [f for f in u2 if narrowmatch(f)] | |
77 | return u1, u2 |
|
76 | return u1, u2 |
@@ -10,14 +10,13 b' from __future__ import absolute_import' | |||||
10 | from mercurial import ( |
|
10 | from mercurial import ( | |
11 | extensions, |
|
11 | extensions, | |
12 | patch, |
|
12 | patch, | |
13 | util, |
|
|||
14 | ) |
|
13 | ) | |
15 |
|
14 | |||
16 | def setup(repo): |
|
15 | def setup(repo): | |
17 | def _filepairs(orig, *args): |
|
16 | def _filepairs(orig, *args): | |
18 | """Only includes files within the narrow spec in the diff.""" |
|
17 | """Only includes files within the narrow spec in the diff.""" | |
19 | if util.safehasattr(repo, 'narrowmatch'): |
|
18 | narrowmatch = repo.narrowmatch() | |
20 |
|
|
19 | if not narrowmatch.always(): | |
21 | for x in orig(*args): |
|
20 | for x in orig(*args): | |
22 | f1, f2, copyop = x |
|
21 | f1, f2, copyop = x | |
23 | if ((not f1 or narrowmatch(f1)) and |
|
22 | if ((not f1 or narrowmatch(f1)) and | |
@@ -29,8 +28,8 b' def setup(repo):' | |||||
29 |
|
28 | |||
30 | def trydiff(orig, repo, revs, ctx1, ctx2, modified, added, removed, |
|
29 | def trydiff(orig, repo, revs, ctx1, ctx2, modified, added, removed, | |
31 | copy, getfilectx, *args, **kwargs): |
|
30 | copy, getfilectx, *args, **kwargs): | |
32 | if util.safehasattr(repo, 'narrowmatch'): |
|
31 | narrowmatch = repo.narrowmatch() | |
33 |
|
|
32 | if not narrowmatch.always(): | |
34 | modified = [f for f in modified if narrowmatch(f)] |
|
33 | modified = [f for f in modified if narrowmatch(f)] | |
35 | added = [f for f in added if narrowmatch(f)] |
|
34 | added = [f for f in added if narrowmatch(f)] | |
36 | removed = [f for f in removed if narrowmatch(f)] |
|
35 | removed = [f for f in removed if narrowmatch(f)] |
@@ -10,7 +10,6 b' from __future__ import absolute_import' | |||||
10 | from mercurial import ( |
|
10 | from mercurial import ( | |
11 | registrar, |
|
11 | registrar, | |
12 | revlog, |
|
12 | revlog, | |
13 | util, |
|
|||
14 | ) |
|
13 | ) | |
15 |
|
14 | |||
16 | keywords = {} |
|
15 | keywords = {} | |
@@ -33,8 +32,8 b' def ellipsis(repo, ctx, templ, **args):' | |||||
33 | def outsidenarrow(repo, ctx, templ, **args): |
|
32 | def outsidenarrow(repo, ctx, templ, **args): | |
34 | """String. 'outsidenarrow' if the change affects no tracked files, |
|
33 | """String. 'outsidenarrow' if the change affects no tracked files, | |
35 | else ''.""" |
|
34 | else ''.""" | |
36 | if util.safehasattr(repo, 'narrowmatch'): |
|
35 | m = repo.narrowmatch() | |
37 | m = repo.narrowmatch() |
|
36 | if not m.always(): | |
38 | if not any(m(f) for f in ctx.files()): |
|
37 | if not any(m(f) for f in ctx.files()): | |
39 | return 'outsidenarrow' |
|
38 | return 'outsidenarrow' | |
40 | return '' |
|
39 | return '' |
General Comments 0
You need to be logged in to leave comments.
Login now