##// END OF EJS Templates
remove unused "head" hack from util._matcher
Alexis S. L. Carvalho -
r4197:492d0d5b default
parent child Browse files
Show More
@@ -127,16 +127,16 b' def make_file(repo, pat, node=None,'
127 127 pathname),
128 128 mode)
129 129
130 def matchpats(repo, pats=[], opts={}, head='', globbed=False, default=None):
130 def matchpats(repo, pats=[], opts={}, globbed=False, default=None):
131 131 cwd = repo.getcwd()
132 132 return util.cmdmatcher(repo.root, cwd, pats or [], opts.get('include'),
133 opts.get('exclude'), head, globbed=globbed,
133 opts.get('exclude'), globbed=globbed,
134 134 default=default)
135 135
136 def walk(repo, pats=[], opts={}, node=None, head='', badmatch=None,
137 globbed=False, default=None):
138 files, matchfn, anypats = matchpats(repo, pats, opts, head,
139 globbed=globbed, default=default)
136 def walk(repo, pats=[], opts={}, node=None, badmatch=None, globbed=False,
137 default=None):
138 files, matchfn, anypats = matchpats(repo, pats, opts, globbed=globbed,
139 default=default)
140 140 exact = dict.fromkeys(files)
141 141 for src, fn in repo.walk(node=node, files=files, match=matchfn,
142 142 badmatch=badmatch):
@@ -378,17 +378,17 b' def canonpath(root, cwd, myname):'
378 378
379 379 raise Abort('%s not under root' % myname)
380 380
381 def matcher(canonroot, cwd='', names=[], inc=[], exc=[], head='', src=None):
382 return _matcher(canonroot, cwd, names, inc, exc, head, 'glob', src)
381 def matcher(canonroot, cwd='', names=[], inc=[], exc=[], src=None):
382 return _matcher(canonroot, cwd, names, inc, exc, 'glob', src)
383 383
384 def cmdmatcher(canonroot, cwd='', names=[], inc=[], exc=[], head='',
385 src=None, globbed=False, default=None):
384 def cmdmatcher(canonroot, cwd='', names=[], inc=[], exc=[], src=None,
385 globbed=False, default=None):
386 386 default = default or 'relpath'
387 387 if default == 'relpath' and not globbed:
388 388 names = expand_glob(names)
389 return _matcher(canonroot, cwd, names, inc, exc, head, default, src)
389 return _matcher(canonroot, cwd, names, inc, exc, default, src)
390 390
391 def _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat, src):
391 def _matcher(canonroot, cwd, names, inc, exc, dflt_pat, src):
392 392 """build a function to match a set of file patterns
393 393
394 394 arguments:
@@ -397,7 +397,6 b' def _matcher(canonroot, cwd, names, inc,'
397 397 names - patterns to find
398 398 inc - patterns to include
399 399 exc - patterns to exclude
400 head - a regex to prepend to patterns to control whether a match is rooted
401 400 dflt_pat - if a pattern in names has no explicit type, assume this one
402 401 src - where these patterns came from (e.g. .hgignore)
403 402
@@ -417,9 +416,6 b' def _matcher(canonroot, cwd, names, inc,'
417 416 includes the initial part of glob: patterns that has no glob characters
418 417 - a bool match(filename) function
419 418 - a bool indicating if any patterns were passed in
420
421 todo:
422 make head regex a rooted bool
423 419 """
424 420
425 421 def contains_glob(name):
@@ -436,14 +432,14 b' def _matcher(canonroot, cwd, names, inc,'
436 432 elif kind == 'path':
437 433 return '^' + re.escape(name) + '(?:/|$)'
438 434 elif kind == 'relglob':
439 return head + globre(name, '(?:|.*/)', '(?:/|$)')
435 return globre(name, '(?:|.*/)', '(?:/|$)')
440 436 elif kind == 'relpath':
441 return head + re.escape(name) + '(?:/|$)'
437 return re.escape(name) + '(?:/|$)'
442 438 elif kind == 'relre':
443 439 if name.startswith('^'):
444 440 return name
445 441 return '.*' + name
446 return head + globre(name, '', tail)
442 return globre(name, '', tail)
447 443
448 444 def matchfn(pats, tail):
449 445 """build a matching function from a set of patterns"""
General Comments 0
You need to be logged in to leave comments. Login now