# HG changeset patch # User Alexis S. L. Carvalho # Date 1175671326 10800 # Node ID 702f48570eb34b1a91a955e04dc2b34574cbd63e # Parent 6cecaec07cc9a47757a939ac3dc7d6875d648a01 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"). diff -r 6cecaec07cc9 -r 702f48570eb3 mercurial/util.py --- 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': diff -r 6cecaec07cc9 -r 702f48570eb3 tests/test-locate --- 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$' diff -r 6cecaec07cc9 -r 702f48570eb3 tests/test-locate.out --- 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 diff -r 6cecaec07cc9 -r 702f48570eb3 tests/test-walk --- 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 diff -r 6cecaec07cc9 -r 702f48570eb3 tests/test-walk.out --- 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