changeset 2670:93eb49419760

Fix dirstate.walkhelper removing first char of nd when self.root == '/'.
author Gil <gil@fooplanet.com>
date Tue, 25 Jul 2006 11:09:17 -0700
parents b013c9daae69
children 82864a2eb709
files mercurial/dirstate.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Tue Jul 25 17:54:58 2006 +0200
+++ b/mercurial/dirstate.py	Tue Jul 25 11:09:17 2006 -0700
@@ -347,12 +347,16 @@
         # recursion free walker, faster than os.walk.
         def findfiles(s):
             work = [s]
+            # self.root may end with a path separator when self.root == '/'
+            root_subtract_len = len(self.root)
+            if not self.root.endswith('/'):
+                root_subtract_len += 1
             while work:
                 top = work.pop()
                 names = os.listdir(top)
                 names.sort()
                 # nd is the top of the repository dir tree
-                nd = util.normpath(top[len(self.root) + 1:])
+                nd = util.normpath(top[root_subtract_len:])
                 if nd == '.':
                     nd = ''
                 else: