comparison mercurial/dirstate.py @ 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 5c10b7ed3411
children 82864a2eb709
comparison
equal deleted inserted replaced
2669:b013c9daae69 2670:93eb49419760
345 # 345 #
346 def walkhelper(self, files, statmatch, dc, badmatch=None): 346 def walkhelper(self, files, statmatch, dc, badmatch=None):
347 # recursion free walker, faster than os.walk. 347 # recursion free walker, faster than os.walk.
348 def findfiles(s): 348 def findfiles(s):
349 work = [s] 349 work = [s]
350 # self.root may end with a path separator when self.root == '/'
351 root_subtract_len = len(self.root)
352 if not self.root.endswith('/'):
353 root_subtract_len += 1
350 while work: 354 while work:
351 top = work.pop() 355 top = work.pop()
352 names = os.listdir(top) 356 names = os.listdir(top)
353 names.sort() 357 names.sort()
354 # nd is the top of the repository dir tree 358 # nd is the top of the repository dir tree
355 nd = util.normpath(top[len(self.root) + 1:]) 359 nd = util.normpath(top[root_subtract_len:])
356 if nd == '.': 360 if nd == '.':
357 nd = '' 361 nd = ''
358 else: 362 else:
359 # do not recurse into a repo contained in this 363 # do not recurse into a repo contained in this
360 # one. use bisect to find .hg directory so speed 364 # one. use bisect to find .hg directory so speed