##// END OF EJS Templates
util.*matcher: change default "names" argument...
Alexis S. L. Carvalho -
r4190:769bc4af default
parent child Browse files
Show More
@@ -378,10 +378,10 b' def canonpath(root, cwd, myname):'
378
378
379 raise Abort('%s not under root' % myname)
379 raise Abort('%s not under root' % myname)
380
380
381 def matcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None):
381 def matcher(canonroot, cwd='', names=[], inc=[], exc=[], head='', src=None):
382 return _matcher(canonroot, cwd, names, inc, exc, head, 'glob', src)
382 return _matcher(canonroot, cwd, names, inc, exc, head, 'glob', src)
383
383
384 def cmdmatcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='',
384 def cmdmatcher(canonroot, cwd='', names=[], inc=[], exc=[], head='',
385 src=None, globbed=False):
385 src=None, globbed=False):
386 if not globbed:
386 if not globbed:
387 names = expand_glob(names)
387 names = expand_glob(names)
@@ -428,6 +428,8 b' def _matcher(canonroot, cwd, names, inc,'
428
428
429 def regex(kind, name, tail):
429 def regex(kind, name, tail):
430 '''convert a pattern into a regular expression'''
430 '''convert a pattern into a regular expression'''
431 if not name:
432 return ''
431 if kind == 're':
433 if kind == 're':
432 return name
434 return name
433 elif kind == 'path':
435 elif kind == 'path':
@@ -477,8 +479,6 b' def _matcher(canonroot, cwd, names, inc,'
477 for kind, name in [patkind(p, dflt_pat) for p in names]:
479 for kind, name in [patkind(p, dflt_pat) for p in names]:
478 if kind in ('glob', 'relpath'):
480 if kind in ('glob', 'relpath'):
479 name = canonpath(canonroot, cwd, name)
481 name = canonpath(canonroot, cwd, name)
480 if name == '':
481 kind, name = 'glob', '**'
482 elif kind in ('relglob', 'path'):
482 elif kind in ('relglob', 'path'):
483 name = normpath(name)
483 name = normpath(name)
484 if kind in ('glob', 're', 'relglob'):
484 if kind in ('glob', 're', 'relglob'):
@@ -509,7 +509,7 b' def _matcher(canonroot, cwd, names, inc,'
509 (not pats and not files) or
509 (not pats and not files) or
510 (pats and patmatch(fn)) or
510 (pats and patmatch(fn)) or
511 (files and filematch(fn)))),
511 (files and filematch(fn)))),
512 (inc or exc or (pats and pats != [('glob', '**')])) and True)
512 (inc or exc or pats) and True)
513
513
514 def system(cmd, environ={}, cwd=None, onerr=None, errprefix=None):
514 def system(cmd, environ={}, cwd=None, onerr=None, errprefix=None):
515 '''enhanced shell command execution.
515 '''enhanced shell command execution.
@@ -19,8 +19,10 b' echo glob:glob > glob:glob'
19 hg addremove
19 hg addremove
20 hg commit -m "commit #0" -d "1000000 0"
20 hg commit -m "commit #0" -d "1000000 0"
21 hg debugwalk
21 hg debugwalk
22 hg debugwalk -I.
22 cd mammals
23 cd mammals
23 hg debugwalk .
24 hg debugwalk .
25 hg debugwalk -I.
24 hg debugwalk Procyonidae
26 hg debugwalk Procyonidae
25 cd Procyonidae
27 cd Procyonidae
26 hg debugwalk .
28 hg debugwalk .
@@ -26,6 +26,24 b' f mammals/Procyonidae/cacomistle mamma'
26 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
26 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
27 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
27 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
28 f mammals/skunk mammals/skunk
28 f mammals/skunk mammals/skunk
29 f beans/black beans/black
30 f beans/borlotti beans/borlotti
31 f beans/kidney beans/kidney
32 f beans/navy beans/navy
33 f beans/pinto beans/pinto
34 f beans/turtle beans/turtle
35 f fennel fennel
36 f fenugreek fenugreek
37 f fiddlehead fiddlehead
38 f glob:glob glob:glob
39 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
40 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
41 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
42 f mammals/skunk mammals/skunk
43 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
44 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
45 f mammals/Procyonidae/raccoon Procyonidae/raccoon
46 f mammals/skunk skunk
29 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
47 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
30 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
48 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
31 f mammals/Procyonidae/raccoon Procyonidae/raccoon
49 f mammals/Procyonidae/raccoon Procyonidae/raccoon
General Comments 0
You need to be logged in to leave comments. Login now