Show More
@@ -66,47 +66,39 b' class match(object):' | |||
|
66 | 66 | self._ctx = ctx |
|
67 | 67 | self._always = False |
|
68 | 68 | |
|
69 | matchfns = [] | |
|
69 | 70 | if include: |
|
70 | 71 | kindpats = _normalize(include, 'glob', root, cwd, auditor) |
|
71 | 72 | self.includepat, im = _buildmatch(ctx, kindpats, '(?:/|$)') |
|
73 | matchfns.append(im) | |
|
72 | 74 | if exclude: |
|
73 | 75 | kindpats = _normalize(exclude, 'glob', root, cwd, auditor) |
|
74 | 76 | self.excludepat, em = _buildmatch(ctx, kindpats, '(?:/|$)') |
|
77 | matchfns.append(lambda f: not em(f)) | |
|
75 | 78 | if exact: |
|
76 | 79 | if isinstance(patterns, list): |
|
77 | 80 | self._files = patterns |
|
78 | 81 | else: |
|
79 | 82 | self._files = list(patterns) |
|
80 |
|
|
|
83 | matchfns.append(self.exact) | |
|
81 | 84 | elif patterns: |
|
82 | 85 | kindpats = _normalize(patterns, default, root, cwd, auditor) |
|
83 | 86 | self._files = _roots(kindpats) |
|
84 | 87 | self._anypats = self._anypats or _anypats(kindpats) |
|
85 | 88 | self.patternspat, pm = _buildmatch(ctx, kindpats, '$') |
|
89 | matchfns.append(pm) | |
|
86 | 90 | |
|
87 |
if |
|
|
88 | if include: | |
|
89 | if exclude: | |
|
90 | m = lambda f: im(f) and not em(f) and pm(f) | |
|
91 |
|
|
|
92 | m = lambda f: im(f) and pm(f) | |
|
93 | else: | |
|
94 | if exclude: | |
|
95 | m = lambda f: not em(f) and pm(f) | |
|
96 | else: | |
|
97 | m = pm | |
|
91 | if not matchfns: | |
|
92 | m = util.always | |
|
93 | self._always = True | |
|
94 | elif len(matchfns) == 1: | |
|
95 | m = matchfns[0] | |
|
98 | 96 | else: |
|
99 |
|
|
|
100 | if exclude: | |
|
101 |
|
|
|
102 |
else |
|
|
103 |
|
|
|
104 | else: | |
|
105 | if exclude: | |
|
106 | m = lambda f: not em(f) | |
|
107 | else: | |
|
108 | m = lambda f: True | |
|
109 | self._always = True | |
|
97 | def m(f): | |
|
98 | for matchfn in matchfns: | |
|
99 | if not matchfn(f): | |
|
100 | return False | |
|
101 | return True | |
|
110 | 102 | |
|
111 | 103 | self.matchfn = m |
|
112 | 104 | self._fmap = set(self._files) |
General Comments 0
You need to be logged in to leave comments.
Login now