Mercurial > hg
changeset 4307:702f48570eb3
change relglob: patterns to be consistent with glob: patterns
With this change, you have to use "hg locate 'hgweb/**'" to locate
all the files in directories named hgweb. OTOH, "hg locate '*l'"
will locate only files that end with "l" - e.g. a file called "hg.py"
will not be matched just because it's in a directory whose name ends
with "l" (e.g. "mercurial").
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Wed, 04 Apr 2007 04:22:06 -0300 |
parents | 6cecaec07cc9 |
children | a5cde03cd019 |
files | mercurial/util.py tests/test-locate tests/test-locate.out tests/test-walk tests/test-walk.out |
diffstat | 5 files changed, 19 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Wed Apr 04 04:22:05 2007 -0300 +++ b/mercurial/util.py Wed Apr 04 04:22:06 2007 -0300 @@ -436,7 +436,7 @@ elif kind == 'path': return '^' + re.escape(name) + '(?:/|$)' elif kind == 'relglob': - return globre(name, '(?:|.*/)', '(?:/|$)') + return globre(name, '(?:|.*/)', tail) elif kind == 'relpath': return re.escape(name) + '(?:/|$)' elif kind == 'relre':
--- a/tests/test-locate Wed Apr 04 04:22:05 2007 -0300 +++ b/tests/test-locate Wed Apr 04 04:22:06 2007 -0300 @@ -19,6 +19,8 @@ echo 0 > t/x echo 0 > t/b echo 0 > t/e.h +mkdir dir.h +echo 0 > dir.h/foo hg ci -A -m m -d "1000000 0" touch nottracked hglocate a && echo locate succeeded || echo locate failed @@ -39,14 +41,14 @@ # test issue294 cd .. rm -r t -hglocate t +hglocate 't/**' mkdir otherdir cd otherdir hglocate b hglocate '*.h' hglocate path:t/x -hglocate 're:.*\.h' +hglocate 're:.*\.h$' hglocate -r 0 b hglocate -r 0 '*.h' hglocate -r 0 path:t/x -hglocate -r 0 're:.*\.h' +hglocate -r 0 're:.*\.h$'
--- a/tests/test-locate.out Wed Apr 04 04:22:05 2007 -0300 +++ b/tests/test-locate.out Wed Apr 04 04:22:06 2007 -0300 @@ -1,5 +1,6 @@ adding a adding b +adding dir.h/foo adding t.h adding t/b adding t/e.h @@ -14,6 +15,7 @@ hg locate a b +dir.h/foo t.h t/b t/e.h @@ -25,6 +27,7 @@ hg locate b +dir.h/foo t.h t/b t/e.h @@ -38,6 +41,7 @@ hg locate -r 0 a b +dir.h/foo t.h t/b t/e.h @@ -46,6 +50,7 @@ % -I/-X with relative path should work hg locate b +dir.h/foo t.h t/b t/e.h @@ -56,7 +61,7 @@ t/e.h t/x -hg locate t +hg locate t/** t/b t/e.h t/x @@ -72,7 +77,7 @@ hg locate path:t/x ../t/x -hg locate re:.*\.h +hg locate re:.*\.h$ ../t.h ../t/e.h @@ -87,7 +92,7 @@ hg locate -r 0 path:t/x ../t/x -hg locate -r 0 re:.*\.h +hg locate -r 0 re:.*\.h$ ../t.h ../t/e.h
--- a/tests/test-walk Wed Apr 04 04:22:05 2007 -0300 +++ b/tests/test-walk Wed Apr 04 04:22:06 2007 -0300 @@ -77,7 +77,8 @@ debugwalk path:beans/black debugwalk path:beans//black debugwalk relglob:Procyonidae -debugwalk relglob:Procyonidae/ fennel +debugwalk 'relglob:Procyonidae/**' +debugwalk 'relglob:Procyonidae/**' fennel debugwalk beans 'glob:beans/*' debugwalk 'glob:mamm**' debugwalk 'glob:mamm**' fennel
--- a/tests/test-walk.out Wed Apr 04 04:22:05 2007 -0300 +++ b/tests/test-walk.out Wed Apr 04 04:22:06 2007 -0300 @@ -232,11 +232,13 @@ f beans/black beans/black exact hg debugwalk relglob:Procyonidae + +hg debugwalk relglob:Procyonidae/** f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon -hg debugwalk relglob:Procyonidae/ fennel +hg debugwalk relglob:Procyonidae/** fennel f fennel fennel exact f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi