Mercurial > hg
changeset 4188:ce3ecf99a18b
util._matcher: fix handling of relglob: patterns
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 10 Mar 2007 23:00:48 -0300 |
parents | 01c4ea5e788c |
children | b1716a1f79c4 |
files | mercurial/util.py tests/test-walk tests/test-walk.out |
diffstat | 3 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Sat Mar 10 23:00:47 2007 -0300 +++ b/mercurial/util.py Sat Mar 10 23:00:48 2007 -0300 @@ -433,7 +433,7 @@ elif kind == 'path': return '^' + re.escape(name) + '(?:/|$)' elif kind == 'relglob': - return head + globre(name, '(?:|.*/)', tail) + return head + globre(name, '(?:|.*/)', '(?:/|$)') elif kind == 'relpath': return head + re.escape(name) + tail elif kind == 'relre': @@ -479,7 +479,9 @@ name = canonpath(canonroot, cwd, name) if name == '': kind, name = 'glob', '**' - if kind in ('glob', 'path', 're'): + elif kind == 'relglob': + name = normpath(name) + if kind in ('glob', 'path', 're', 'relglob'): pats.append((kind, name)) if kind == 'glob': root = globprefix(name) @@ -487,6 +489,8 @@ elif kind == 'relpath': files.append((kind, name)) roots.append(name) + elif kind == 'relglob': + roots.append('.') patmatch = matchfn(pats, '$') or always filematch = matchfn(files, '(?:/|$)') or always
--- a/tests/test-walk Sat Mar 10 23:00:47 2007 -0300 +++ b/tests/test-walk Sat Mar 10 23:00:48 2007 -0300 @@ -48,6 +48,8 @@ hg debugwalk glob:\* hg debugwalk 're:.*[kb]$' hg debugwalk path:beans/black +hg debugwalk relglob:Procyonidae +hg debugwalk relglob:Procyonidae/ fennel hg debugwalk beans 'glob:beans/*' hg debugwalk 'glob:mamm**' hg debugwalk 'glob:mamm**' fennel
--- a/tests/test-walk.out Sat Mar 10 23:00:47 2007 -0300 +++ b/tests/test-walk.out Sat Mar 10 23:00:48 2007 -0300 @@ -84,6 +84,13 @@ f glob:glob glob:glob f mammals/skunk mammals/skunk f beans/black beans/black +f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle +f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi +f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon +f fennel fennel exact +f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle +f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi +f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon f beans/black beans/black f beans/borlotti beans/borlotti f beans/kidney beans/kidney