Show More
@@ -474,16 +474,50 b' class dirstate(object):' | |||
|
474 | 474 | s_isdir = stat.S_ISDIR |
|
475 | 475 | supported = self._supported |
|
476 | 476 | _join = self._join |
|
477 | work = [] | |
|
478 | wadd = work.append | |
|
479 | found = [] | |
|
480 | add = found.append | |
|
481 | ||
|
477 | 482 | known = {'.hg': 1} |
|
478 | 483 | |
|
479 | # recursion free walker, faster than os.walk. | |
|
480 |
|
|
|
481 | work = [s] | |
|
482 |
|
|
|
483 |
f |
|
|
484 | add = found.append | |
|
484 | # step one, find all files that match our criteria | |
|
485 | for ff in util.sort(files): | |
|
486 | nf = normpath(ff) | |
|
487 | nn = self.normalize(nf) | |
|
488 | f = _join(ff) | |
|
489 | if nn in known: | |
|
490 | continue | |
|
491 | ||
|
492 | try: | |
|
493 | st = lstat(f) | |
|
494 | except OSError, inst: | |
|
495 | keep = False | |
|
496 | for fn in dc: | |
|
497 | if nf == fn or (fn.startswith(nf) and fn[len(nf)] == '/'): | |
|
498 | keep = True | |
|
499 | break | |
|
500 | if not keep: | |
|
501 | if inst.errno != errno.ENOENT: | |
|
502 | fwarn(ff, inst.strerror) | |
|
503 | elif badfn(ff, inst.strerror) and imatch(nf): | |
|
504 | yield ff, None | |
|
505 | continue | |
|
506 | ||
|
507 | if not s_isdir(st.st_mode): | |
|
508 | known[nn] = 1 | |
|
509 | if supported(ff, st.st_mode, verbose=True): | |
|
510 | yield self.normalize(nf), st | |
|
511 | elif ff in dc: | |
|
512 | yield nf, None | |
|
513 | continue | |
|
514 | ||
|
515 | if dirignore(nf): | |
|
516 | continue | |
|
517 | ||
|
485 | 518 | if hasattr(match, 'dir'): |
|
486 |
match.dir(normpath( |
|
|
519 | match.dir(normpath(f[common_prefix_len:])) | |
|
520 | wadd(f) | |
|
487 | 521 | while work: |
|
488 | 522 | top = work.pop() |
|
489 | 523 | entries = listdir(top, stat=True) |
@@ -520,39 +554,8 b' class dirstate(object):' | |||
|
520 | 554 | add((nn, st)) |
|
521 | 555 | elif np in dc: |
|
522 | 556 | add((nn, None)) |
|
523 |
|
|
|
524 | ||
|
525 | # step one, find all files that match our criteria | |
|
526 | for ff in util.sort(files): | |
|
527 | nf = normpath(ff) | |
|
528 | nn = self.normalize(nf) | |
|
529 | f = _join(ff) | |
|
530 | try: | |
|
531 | st = lstat(f) | |
|
532 | except OSError, inst: | |
|
533 | found = False | |
|
534 | for fn in dc: | |
|
535 | if nf == fn or (fn.startswith(nf) and fn[len(nf)] == '/'): | |
|
536 | found = True | |
|
537 | break | |
|
538 | if not found: | |
|
539 | if inst.errno != errno.ENOENT: | |
|
540 | fwarn(ff, inst.strerror) | |
|
541 | elif badfn(ff, inst.strerror) and imatch(nf): | |
|
542 | yield ff, None | |
|
543 | continue | |
|
544 | if s_isdir(st.st_mode): | |
|
545 | if not dirignore(nf): | |
|
546 | for e in findfiles(f): | |
|
547 | yield e | |
|
548 | else: | |
|
549 | if nn in known: | |
|
550 | continue | |
|
551 | known[nn] = 1 | |
|
552 | if supported(ff, st.st_mode, verbose=True): | |
|
553 | yield self.normalize(nf), st | |
|
554 | elif ff in dc: | |
|
555 | yield nf, None | |
|
557 | for e in util.sort(found): | |
|
558 | yield e | |
|
556 | 559 | |
|
557 | 560 | # step two run through anything left in the dc hash and yield |
|
558 | 561 | # if we haven't already seen it |
General Comments 0
You need to be logged in to leave comments.
Login now