Show More
@@ -34,6 +34,15 def _expandsets(kindpats, ctx): | |||||
34 | other.append((kind, pat)) |
|
34 | other.append((kind, pat)) | |
35 | return fset, other |
|
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 | class match(object): |
|
46 | class match(object): | |
38 | def __init__(self, root, cwd, patterns, include=[], exclude=[], |
|
47 | def __init__(self, root, cwd, patterns, include=[], exclude=[], | |
39 | default='glob', exact=False, auditor=None, ctx=None): |
|
48 | default='glob', exact=False, auditor=None, ctx=None): | |
@@ -84,6 +93,7 class match(object): | |||||
84 | matchfns.append(self.exact) |
|
93 | matchfns.append(self.exact) | |
85 | elif patterns: |
|
94 | elif patterns: | |
86 | kindpats = _normalize(patterns, default, root, cwd, auditor) |
|
95 | kindpats = _normalize(patterns, default, root, cwd, auditor) | |
|
96 | if not _kindpatsalwaysmatch(kindpats): | |||
87 | self._files = _roots(kindpats) |
|
97 | self._files = _roots(kindpats) | |
88 | self._anypats = self._anypats or _anypats(kindpats) |
|
98 | self._anypats = self._anypats or _anypats(kindpats) | |
89 | self.patternspat, pm = _buildmatch(ctx, kindpats, '$') |
|
99 | self.patternspat, pm = _buildmatch(ctx, kindpats, '$') |
@@ -725,6 +725,8 def matchandpats(ctx, pats=[], opts={}, | |||||
725 | def badfn(f, msg): |
|
725 | def badfn(f, msg): | |
726 | ctx.repo().ui.warn("%s: %s\n" % (m.rel(f), msg)) |
|
726 | ctx.repo().ui.warn("%s: %s\n" % (m.rel(f), msg)) | |
727 | m.bad = badfn |
|
727 | m.bad = badfn | |
|
728 | if m.always(): | |||
|
729 | pats = [] | |||
728 | return m, pats |
|
730 | return m, pats | |
729 |
|
731 | |||
730 | def match(ctx, pats=[], opts={}, globbed=False, default='relpath'): |
|
732 | def match(ctx, pats=[], opts={}, globbed=False, default='relpath'): |
General Comments 0
You need to be logged in to leave comments.
Login now