# HG changeset patch # User Alexis S. L. Carvalho # Date 1173578451 10800 # Node ID 769bc4af561d174c720915381655f39a57b4718f # Parent b1716a1f79c4c2340a343ce61e5e7adcd85d6153 util.*matcher: change default "names" argument names=['.'] means "include (recursively) only files from the current subdir"; the function then did a hack to walk the whole tree. Clean that up. This also fixes a problem where "--include ." works in a subdir, but not on the tree root. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -378,10 +378,10 @@ def canonpath(root, cwd, myname): raise Abort('%s not under root' % myname) -def matcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None): +def matcher(canonroot, cwd='', names=[], inc=[], exc=[], head='', src=None): return _matcher(canonroot, cwd, names, inc, exc, head, 'glob', src) -def cmdmatcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', +def cmdmatcher(canonroot, cwd='', names=[], inc=[], exc=[], head='', src=None, globbed=False): if not globbed: names = expand_glob(names) @@ -428,6 +428,8 @@ def _matcher(canonroot, cwd, names, inc, def regex(kind, name, tail): '''convert a pattern into a regular expression''' + if not name: + return '' if kind == 're': return name elif kind == 'path': @@ -477,8 +479,6 @@ def _matcher(canonroot, cwd, names, inc, for kind, name in [patkind(p, dflt_pat) for p in names]: if kind in ('glob', 'relpath'): name = canonpath(canonroot, cwd, name) - if name == '': - kind, name = 'glob', '**' elif kind in ('relglob', 'path'): name = normpath(name) if kind in ('glob', 're', 'relglob'): @@ -509,7 +509,7 @@ def _matcher(canonroot, cwd, names, inc, (not pats and not files) or (pats and patmatch(fn)) or (files and filematch(fn)))), - (inc or exc or (pats and pats != [('glob', '**')])) and True) + (inc or exc or pats) and True) def system(cmd, environ={}, cwd=None, onerr=None, errprefix=None): '''enhanced shell command execution. diff --git a/tests/test-walk b/tests/test-walk --- a/tests/test-walk +++ b/tests/test-walk @@ -19,8 +19,10 @@ echo glob:glob > glob:glob hg addremove hg commit -m "commit #0" -d "1000000 0" hg debugwalk +hg debugwalk -I. cd mammals hg debugwalk . +hg debugwalk -I. hg debugwalk Procyonidae cd Procyonidae hg debugwalk . diff --git a/tests/test-walk.out b/tests/test-walk.out --- a/tests/test-walk.out +++ b/tests/test-walk.out @@ -26,6 +26,24 @@ f mammals/Procyonidae/cacomistle mamma f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon f mammals/skunk mammals/skunk +f beans/black beans/black +f beans/borlotti beans/borlotti +f beans/kidney beans/kidney +f beans/navy beans/navy +f beans/pinto beans/pinto +f beans/turtle beans/turtle +f fennel fennel +f fenugreek fenugreek +f fiddlehead fiddlehead +f glob:glob glob:glob +f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle +f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi +f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon +f mammals/skunk mammals/skunk +f mammals/Procyonidae/cacomistle Procyonidae/cacomistle +f mammals/Procyonidae/coatimundi Procyonidae/coatimundi +f mammals/Procyonidae/raccoon Procyonidae/raccoon +f mammals/skunk skunk f mammals/Procyonidae/cacomistle Procyonidae/cacomistle f mammals/Procyonidae/coatimundi Procyonidae/coatimundi f mammals/Procyonidae/raccoon Procyonidae/raccoon