##// END OF EJS Templates
util._matcher: fix handling of relglob: patterns
Alexis S. L. Carvalho -
r4188:ce3ecf99 default
parent child Browse files
Show More
@@ -433,7 +433,7 b' def _matcher(canonroot, cwd, names, inc,'
433 elif kind == 'path':
433 elif kind == 'path':
434 return '^' + re.escape(name) + '(?:/|$)'
434 return '^' + re.escape(name) + '(?:/|$)'
435 elif kind == 'relglob':
435 elif kind == 'relglob':
436 return head + globre(name, '(?:|.*/)', tail)
436 return head + globre(name, '(?:|.*/)', '(?:/|$)')
437 elif kind == 'relpath':
437 elif kind == 'relpath':
438 return head + re.escape(name) + tail
438 return head + re.escape(name) + tail
439 elif kind == 'relre':
439 elif kind == 'relre':
@@ -479,7 +479,9 b' def _matcher(canonroot, cwd, names, inc,'
479 name = canonpath(canonroot, cwd, name)
479 name = canonpath(canonroot, cwd, name)
480 if name == '':
480 if name == '':
481 kind, name = 'glob', '**'
481 kind, name = 'glob', '**'
482 if kind in ('glob', 'path', 're'):
482 elif kind == 'relglob':
483 name = normpath(name)
484 if kind in ('glob', 'path', 're', 'relglob'):
483 pats.append((kind, name))
485 pats.append((kind, name))
484 if kind == 'glob':
486 if kind == 'glob':
485 root = globprefix(name)
487 root = globprefix(name)
@@ -487,6 +489,8 b' def _matcher(canonroot, cwd, names, inc,'
487 elif kind == 'relpath':
489 elif kind == 'relpath':
488 files.append((kind, name))
490 files.append((kind, name))
489 roots.append(name)
491 roots.append(name)
492 elif kind == 'relglob':
493 roots.append('.')
490
494
491 patmatch = matchfn(pats, '$') or always
495 patmatch = matchfn(pats, '$') or always
492 filematch = matchfn(files, '(?:/|$)') or always
496 filematch = matchfn(files, '(?:/|$)') or always
@@ -48,6 +48,8 b' hg debugwalk beans/.hg'
48 hg debugwalk glob:\*
48 hg debugwalk glob:\*
49 hg debugwalk 're:.*[kb]$'
49 hg debugwalk 're:.*[kb]$'
50 hg debugwalk path:beans/black
50 hg debugwalk path:beans/black
51 hg debugwalk relglob:Procyonidae
52 hg debugwalk relglob:Procyonidae/ fennel
51 hg debugwalk beans 'glob:beans/*'
53 hg debugwalk beans 'glob:beans/*'
52 hg debugwalk 'glob:mamm**'
54 hg debugwalk 'glob:mamm**'
53 hg debugwalk 'glob:mamm**' fennel
55 hg debugwalk 'glob:mamm**' fennel
@@ -84,6 +84,13 b' f fenugreek fenugreek'
84 f glob:glob glob:glob
84 f glob:glob glob:glob
85 f mammals/skunk mammals/skunk
85 f mammals/skunk mammals/skunk
86 f beans/black beans/black
86 f beans/black beans/black
87 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
88 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
89 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
90 f fennel fennel exact
91 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
92 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
93 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
87 f beans/black beans/black
94 f beans/black beans/black
88 f beans/borlotti beans/borlotti
95 f beans/borlotti beans/borlotti
89 f beans/kidney beans/kidney
96 f beans/kidney beans/kidney
General Comments 0
You need to be logged in to leave comments. Login now