##// END OF EJS Templates
self.root == '/': prefix length computation out of the loop...
Benoit Boissinot -
r2671:82864a2e default
parent child Browse files
Show More
@@ -344,19 +344,19 b' class dirstate(object):'
344 # directly by this function, but might be modified by your statmatch call.
344 # directly by this function, but might be modified by your statmatch call.
345 #
345 #
346 def walkhelper(self, files, statmatch, dc, badmatch=None):
346 def walkhelper(self, files, statmatch, dc, badmatch=None):
347 # self.root may end with a path separator when self.root == '/'
348 common_prefix_len = len(self.root)
349 if not self.root.endswith('/'):
350 common_prefix_len += 1
347 # recursion free walker, faster than os.walk.
351 # recursion free walker, faster than os.walk.
348 def findfiles(s):
352 def findfiles(s):
349 work = [s]
353 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
354 while work:
354 while work:
355 top = work.pop()
355 top = work.pop()
356 names = os.listdir(top)
356 names = os.listdir(top)
357 names.sort()
357 names.sort()
358 # nd is the top of the repository dir tree
358 # nd is the top of the repository dir tree
359 nd = util.normpath(top[root_subtract_len:])
359 nd = util.normpath(top[common_prefix_len:])
360 if nd == '.':
360 if nd == '.':
361 nd = ''
361 nd = ''
362 else:
362 else:
General Comments 0
You need to be logged in to leave comments. Login now