Show More
@@ -214,7 +214,7 b' def _patsplit(pat, default):' | |||||
214 | if pat.startswith(prefix + ':'): return pat.split(':', 1) |
|
214 | if pat.startswith(prefix + ':'): return pat.split(':', 1) | |
215 | return default, pat |
|
215 | return default, pat | |
216 |
|
216 | |||
217 | def globre(pat, head='^', tail='$'): |
|
217 | def _globre(pat, head='^', tail='$'): | |
218 | "convert a glob pattern into a regexp" |
|
218 | "convert a glob pattern into a regexp" | |
219 | i, n = 0, len(pat) |
|
219 | i, n = 0, len(pat) | |
220 | res = '' |
|
220 | res = '' | |
@@ -389,14 +389,14 b" def matcher(canonroot, cwd='', names=[]," | |||||
389 | elif kind == 'path': |
|
389 | elif kind == 'path': | |
390 | return '^' + re.escape(name) + '(?:/|$)' |
|
390 | return '^' + re.escape(name) + '(?:/|$)' | |
391 | elif kind == 'relglob': |
|
391 | elif kind == 'relglob': | |
392 | return globre(name, '(?:|.*/)', tail) |
|
392 | return _globre(name, '(?:|.*/)', tail) | |
393 | elif kind == 'relpath': |
|
393 | elif kind == 'relpath': | |
394 | return re.escape(name) + '(?:/|$)' |
|
394 | return re.escape(name) + '(?:/|$)' | |
395 | elif kind == 'relre': |
|
395 | elif kind == 'relre': | |
396 | if name.startswith('^'): |
|
396 | if name.startswith('^'): | |
397 | return name |
|
397 | return name | |
398 | return '.*' + name |
|
398 | return '.*' + name | |
399 | return globre(name, '', tail) |
|
399 | return _globre(name, '', tail) | |
400 |
|
400 | |||
401 | def matchfn(pats, tail): |
|
401 | def matchfn(pats, tail): | |
402 | """build a matching function from a set of patterns""" |
|
402 | """build a matching function from a set of patterns""" |
General Comments 0
You need to be logged in to leave comments.
Login now