A 'glob:foo?bar' pattern determines a root - the tree root
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Sat, 10 Mar 2007 23:00:47 -0300
changeset 4187 01c4ea5e788c
parent 4186 08d31e43592a
child 4188 ce3ecf99a18b
A 'glob:foo?bar' pattern determines a root - the tree root
mercurial/util.py
tests/test-walk
tests/test-walk.out
--- a/mercurial/util.py	Sat Mar 10 23:00:46 2007 -0300
+++ b/mercurial/util.py	Sat Mar 10 23:00:47 2007 -0300
@@ -469,7 +469,7 @@
         for p in pat.split('/'):
             if contains_glob(p): break
             root.append(p)
-        return '/'.join(root)
+        return '/'.join(root) or '.'
 
     pats = []
     files = []
@@ -483,7 +483,7 @@
             pats.append((kind, name))
         if kind == 'glob':
             root = globprefix(name)
-            if root: roots.append(root)
+            roots.append(root)
         elif kind == 'relpath':
             files.append((kind, name))
             roots.append(name)
--- a/tests/test-walk	Sat Mar 10 23:00:46 2007 -0300
+++ b/tests/test-walk	Sat Mar 10 23:00:47 2007 -0300
@@ -49,6 +49,8 @@
 hg debugwalk 're:.*[kb]$'
 hg debugwalk path:beans/black
 hg debugwalk beans 'glob:beans/*'
+hg debugwalk 'glob:mamm**'
+hg debugwalk 'glob:mamm**' fennel
 hg debugwalk 'glob:j*'
 hg debugwalk NOEXIST
 mkfifo fifo
--- a/tests/test-walk.out	Sat Mar 10 23:00:46 2007 -0300
+++ b/tests/test-walk.out	Sat Mar 10 23:00:47 2007 -0300
@@ -90,6 +90,15 @@
 f  beans/navy      beans/navy
 f  beans/pinto     beans/pinto
 f  beans/turtle    beans/turtle
+f  mammals/Procyonidae/cacomistle  mammals/Procyonidae/cacomistle
+f  mammals/Procyonidae/coatimundi  mammals/Procyonidae/coatimundi
+f  mammals/Procyonidae/raccoon     mammals/Procyonidae/raccoon
+f  mammals/skunk                   mammals/skunk
+f  fennel                          fennel                          exact
+f  mammals/Procyonidae/cacomistle  mammals/Procyonidae/cacomistle
+f  mammals/Procyonidae/coatimundi  mammals/Procyonidae/coatimundi
+f  mammals/Procyonidae/raccoon     mammals/Procyonidae/raccoon
+f  mammals/skunk                   mammals/skunk
 NOEXIST: No such file or directory
 fifo: unsupported file type (type is fifo)
 m  fenugreek  fenugreek  exact