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