Show More
@@ -135,7 +135,7 b' def _regex(kind, name, tail):' | |||||
135 | return '.*' + name |
|
135 | return '.*' + name | |
136 | return _globre(name, '', tail) |
|
136 | return _globre(name, '', tail) | |
137 |
|
137 | |||
138 |
def _match |
|
138 | def _buildmatch(pats, tail): | |
139 | """build a matching function from a set of patterns""" |
|
139 | """build a matching function from a set of patterns""" | |
140 | try: |
|
140 | try: | |
141 | pat = '(?:%s)' % '|'.join([_regex(k, p, tail) for (k, p) in pats]) |
|
141 | pat = '(?:%s)' % '|'.join([_regex(k, p, tail) for (k, p) in pats]) | |
@@ -149,7 +149,7 b' def _matchfn(pats, tail):' | |||||
149 | l = len(pats) |
|
149 | l = len(pats) | |
150 | if l < 2: |
|
150 | if l < 2: | |
151 | raise |
|
151 | raise | |
152 |
a, b = _match |
|
152 | a, b = _buildmatch(pats[:l//2], tail), _buildmatch(pats[l//2:], tail) | |
153 | return lambda s: a(s) or b(s) |
|
153 | return lambda s: a(s) or b(s) | |
154 | except re.error: |
|
154 | except re.error: | |
155 | for k, p in pats: |
|
155 | for k, p in pats: | |
@@ -231,11 +231,11 b" def _matcher(root, cwd='', names=[], inc" | |||||
231 | pats = _normalize(names, dflt_pat, root, cwd) |
|
231 | pats = _normalize(names, dflt_pat, root, cwd) | |
232 | roots = _roots(pats) |
|
232 | roots = _roots(pats) | |
233 | anypats = anypats or _anypats(pats) |
|
233 | anypats = anypats or _anypats(pats) | |
234 |
patmatch = _match |
|
234 | patmatch = _buildmatch(pats, '$') | |
235 | if inc: |
|
235 | if inc: | |
236 |
incmatch = _match |
|
236 | incmatch = _buildmatch(_normalize(inc, 'glob', root, cwd), '(?:/|$)') | |
237 | if exc: |
|
237 | if exc: | |
238 |
excmatch = _match |
|
238 | excmatch = _buildmatch(_normalize(exc, 'glob', root, cwd), '(?:/|$)') | |
239 |
|
239 | |||
240 | if names: |
|
240 | if names: | |
241 | if inc: |
|
241 | if inc: |
General Comments 0
You need to be logged in to leave comments.
Login now