filterfiles: Search as long as the target is a prefix of current.
authorBrendan Cully <brendan@kublai.com>
Fri, 23 Jun 2006 00:11:53 +0200
changeset 2485 885de96eb542
parent 2484 eabcda3ed0dd
child 2486 3ea8111ead90
filterfiles: Search as long as the target is a prefix of current. filterfiles was failing to find files for directory arguments if another file existed that started with the directory name and sorted earlier. For example, a manifest of ('foo.h', 'foo/foo') would cause filterfiles('foo') to return nothing. This resolves issue #294.
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Wed Jun 21 22:45:29 2006 -0700
+++ b/mercurial/dirstate.py	Fri Jun 23 00:11:53 2006 +0200
@@ -285,8 +285,9 @@
                 continue
             while bs < blen:
                 s = b[bs]
-                if len(s) > len(x) and s.startswith(x) and s[len(x)] == '/':
-                    ret[s] = self.map[s]
+                if len(s) > len(x) and s.startswith(x):
+                    if s[len(x)] == '/':
+                        ret[s] = self.map[s]
                 else:
                     break
                 bs += 1