##// END OF EJS Templates
dirstate.walk: track normalized directory names
Matt Mackall -
r6823:12081ea6 default
parent child Browse files
Show More
@@ -456,11 +456,6 b' class dirstate(object):'
456 456 ignore = util.never
457 457 dirignore = util.never
458 458
459 # self._root may end with a path separator when self._root == '/'
460 common_prefix_len = len(self._root)
461 if not util.endswithsep(self._root):
462 common_prefix_len += 1
463
464 459 normpath = util.normpath
465 460 normalize = self.normalize
466 461 listdir = osutil.listdir
@@ -482,12 +477,11 b' class dirstate(object):'
482 477 # step one, find all files that match our criteria
483 478 for ff in util.sort(files):
484 479 nf = normalize(normpath(ff))
485 f = _join(nf)
486 480 if nf in seen:
487 481 continue
488 482
489 483 try:
490 st = lstat(f)
484 st = lstat(_join(nf))
491 485 except OSError, inst:
492 486 keep = False
493 487 for fn in dmap:
@@ -513,13 +507,12 b' class dirstate(object):'
513 507 continue
514 508
515 509 if hasattr(match, 'dir'):
516 match.dir(normpath(f[common_prefix_len:]))
517 wadd(f)
510 match.dir(nf)
511 wadd(nf)
518 512 while work:
519 top = work.pop()
520 entries = listdir(top, stat=True)
513 nd = work.pop()
514 entries = listdir(_join(nd), stat=True)
521 515 # nd is the top of the repository dir tree
522 nd = normpath(top[common_prefix_len:])
523 516 if nd == '.':
524 517 nd = ''
525 518 else:
@@ -529,18 +522,17 b' class dirstate(object):'
529 522 names = [e[0] for e in entries]
530 523 hg = bisect_left(names, '.hg')
531 524 if hg < len(names) and names[hg] == '.hg':
532 if isdir(join(top, '.hg')):
525 if isdir(_join(join(nd, '.hg'))):
533 526 continue
534 527 for f, kind, st in entries:
535 528 nf = normalize(pconvert(join(nd, f)))
536 529 if nf in seen:
537 530 continue
538 531 seen[nf] = 1
539 p = join(top, f)
540 532 # don't trip over symlinks
541 533 if kind == stat.S_IFDIR:
542 534 if not ignore(nf):
543 wadd(p)
535 wadd(nf)
544 536 if hasattr(match, 'dir'):
545 537 match.dir(nf)
546 538 if nf in dmap and match(nf):
General Comments 0
You need to be logged in to leave comments. Login now