equal
deleted
inserted
replaced
50 continue |
50 continue |
51 other.append((kind, pat, source)) |
51 other.append((kind, pat, source)) |
52 return fset, other |
52 return fset, other |
53 |
53 |
54 def _expandsubinclude(kindpats, root): |
54 def _expandsubinclude(kindpats, root): |
55 '''Returns the list of subinclude matchers and the kindpats without the |
55 '''Returns the list of subinclude matcher args and the kindpats without the |
56 subincludes in it.''' |
56 subincludes in it.''' |
57 relmatchers = [] |
57 relmatchers = [] |
58 other = [] |
58 other = [] |
59 |
59 |
60 for kind, pat, source in kindpats: |
60 for kind, pat, source in kindpats: |
62 sourceroot = pathutil.dirname(util.normpath(source)) |
62 sourceroot = pathutil.dirname(util.normpath(source)) |
63 pat = util.pconvert(pat) |
63 pat = util.pconvert(pat) |
64 path = pathutil.join(sourceroot, pat) |
64 path = pathutil.join(sourceroot, pat) |
65 |
65 |
66 newroot = pathutil.dirname(path) |
66 newroot = pathutil.dirname(path) |
67 relmatcher = match(newroot, '', [], ['include:%s' % path]) |
67 matcherargs = (newroot, '', [], ['include:%s' % path]) |
68 |
68 |
69 prefix = pathutil.canonpath(root, root, newroot) |
69 prefix = pathutil.canonpath(root, root, newroot) |
70 if prefix: |
70 if prefix: |
71 prefix += '/' |
71 prefix += '/' |
72 relmatchers.append((prefix, relmatcher)) |
72 relmatchers.append((prefix, matcherargs)) |
73 else: |
73 else: |
74 other.append((kind, pat, source)) |
74 other.append((kind, pat, source)) |
75 |
75 |
76 return relmatchers, other |
76 return relmatchers, other |
77 |
77 |
582 globsuffix is appended to the regexp of globs.''' |
582 globsuffix is appended to the regexp of globs.''' |
583 matchfuncs = [] |
583 matchfuncs = [] |
584 |
584 |
585 subincludes, kindpats = _expandsubinclude(kindpats, root) |
585 subincludes, kindpats = _expandsubinclude(kindpats, root) |
586 if subincludes: |
586 if subincludes: |
|
587 submatchers = {} |
587 def matchsubinclude(f): |
588 def matchsubinclude(f): |
588 for prefix, mf in subincludes: |
589 for prefix, matcherargs in subincludes: |
589 if f.startswith(prefix) and mf(f[len(prefix):]): |
590 if f.startswith(prefix): |
590 return True |
591 mf = submatchers.get(prefix) |
|
592 if mf is None: |
|
593 mf = match(*matcherargs) |
|
594 submatchers[prefix] = mf |
|
595 |
|
596 if mf(f[len(prefix):]): |
|
597 return True |
591 return False |
598 return False |
592 matchfuncs.append(matchsubinclude) |
599 matchfuncs.append(matchsubinclude) |
593 |
600 |
594 fset, kindpats = _expandsets(kindpats, ctx, listsubrepos) |
601 fset, kindpats = _expandsets(kindpats, ctx, listsubrepos) |
595 if fset: |
602 if fset: |