##// END OF EJS Templates
matcher: make e.g. 'relpath:.' lead to fast paths...
Martin von Zweigbergk -
r24447:d44d53bc default
parent child Browse files
Show More
@@ -34,6 +34,15 b' def _expandsets(kindpats, ctx):'
34 34 other.append((kind, pat))
35 35 return fset, other
36 36
37 def _kindpatsalwaysmatch(kindpats):
38 """"Checks whether the kindspats match everything, as e.g.
39 'relpath:.' does.
40 """
41 for kind, pat in kindpats:
42 if pat != '' or kind not in ['relpath', 'glob']:
43 return False
44 return True
45
37 46 class match(object):
38 47 def __init__(self, root, cwd, patterns, include=[], exclude=[],
39 48 default='glob', exact=False, auditor=None, ctx=None):
@@ -84,10 +93,11 b' class match(object):'
84 93 matchfns.append(self.exact)
85 94 elif patterns:
86 95 kindpats = _normalize(patterns, default, root, cwd, auditor)
87 self._files = _roots(kindpats)
88 self._anypats = self._anypats or _anypats(kindpats)
89 self.patternspat, pm = _buildmatch(ctx, kindpats, '$')
90 matchfns.append(pm)
96 if not _kindpatsalwaysmatch(kindpats):
97 self._files = _roots(kindpats)
98 self._anypats = self._anypats or _anypats(kindpats)
99 self.patternspat, pm = _buildmatch(ctx, kindpats, '$')
100 matchfns.append(pm)
91 101
92 102 if not matchfns:
93 103 m = util.always
@@ -725,6 +725,8 b' def matchandpats(ctx, pats=[], opts={}, '
725 725 def badfn(f, msg):
726 726 ctx.repo().ui.warn("%s: %s\n" % (m.rel(f), msg))
727 727 m.bad = badfn
728 if m.always():
729 pats = []
728 730 return m, pats
729 731
730 732 def match(ctx, pats=[], opts={}, globbed=False, default='relpath'):
General Comments 0
You need to be logged in to leave comments. Login now