match: let 'path:.' and 'path:' match everything (issue4687)
Previously, both queries exited with code 1, printing nothing. The pattern in
the latter query is normalized to '.', so it is really the same case.
--- a/mercurial/match.py Sat Jun 13 20:14:22 2015 +0900
+++ b/mercurial/match.py Sat Jun 20 19:59:26 2015 -0400
@@ -407,6 +407,8 @@
if kind == 're':
return pat
if kind == 'path':
+ if pat == '.':
+ return ''
return '^' + util.re.escape(pat) + '(?:/|$)'
if kind == 'relglob':
return '(?:|.*/)' + _globre(pat) + globsuffix
--- a/tests/test-locate.t Sat Jun 13 20:14:22 2015 +0900
+++ b/tests/test-locate.t Sat Jun 20 19:59:26 2015 -0400
@@ -106,6 +106,19 @@
$ mkdir otherdir
$ cd otherdir
+ $ hg files path:
+ ../b (glob)
+ ../dir.h/foo (glob)
+ ../t.h (glob)
+ ../t/e.h (glob)
+ ../t/x (glob)
+ $ hg files path:.
+ ../b (glob)
+ ../dir.h/foo (glob)
+ ../t.h (glob)
+ ../t/e.h (glob)
+ ../t/x (glob)
+
$ hg locate b
../b (glob)
../t/b (glob)