changeset 25636:bfe9ed85f27c stable

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 20 Jun 2015 19:59:26 -0400
parents 9452112c8eb0
children 5eccebe23942
files mercurial/match.py tests/test-locate.t
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)