match: let 'path:.' and 'path:' match everything (issue4687) stable
authorMatt Harbison <matt_harbison@yahoo.com>
Sat, 20 Jun 2015 19:59:26 -0400
branchstable
changeset 25636 bfe9ed85f27c
parent 25562 9452112c8eb0
child 25637 5eccebe23942
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.
mercurial/match.py
tests/test-locate.t
--- 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)