Show More
@@ -598,7 +598,7 class workingctx(changectx): | |||
|
598 | 598 | return self._parents[0].ancestor(c2) # punt on two parents for now |
|
599 | 599 | |
|
600 | 600 | def walk(self, match): |
|
601 |
for |
|
|
601 | for fn, st in self._repo.dirstate.walk(match, True, False): | |
|
602 | 602 | yield fn |
|
603 | 603 | |
|
604 | 604 | class workingfilectx(filectx): |
@@ -459,11 +459,7 class dirstate(object): | |||
|
459 | 459 | walk recursively through the directory tree, finding all files |
|
460 | 460 | matched by the match function |
|
461 | 461 | |
|
462 |
results are yielded in a tuple ( |
|
|
463 | is one of: | |
|
464 | 'f' the file was found in the directory tree | |
|
465 | 'm' the file was only in the dirstate and not in the tree | |
|
466 | ||
|
462 | results are yielded in a tuple (filename, stat), where stat | |
|
467 | 463 | and st is the stat result if the file was found in the directory. |
|
468 | 464 | ''' |
|
469 | 465 | |
@@ -551,12 +547,12 class dirstate(object): | |||
|
551 | 547 | if hasattr(match, 'dir'): |
|
552 | 548 | match.dir(np) |
|
553 | 549 | if np in dc and match(np): |
|
554 |
add((nn, |
|
|
550 | add((nn, None)) | |
|
555 | 551 | elif imatch(np): |
|
556 | 552 | if supported(np, st.st_mode): |
|
557 |
add((nn, |
|
|
553 | add((nn, st)) | |
|
558 | 554 | elif np in dc: |
|
559 |
add((nn, |
|
|
555 | add((nn, None)) | |
|
560 | 556 | return util.sort(found) |
|
561 | 557 | |
|
562 | 558 | # step one, find all files that match our criteria |
@@ -576,30 +572,38 class dirstate(object): | |||
|
576 | 572 | if inst.errno != errno.ENOENT: |
|
577 | 573 | fwarn(ff, inst.strerror) |
|
578 | 574 | elif badfn(ff, inst.strerror) and imatch(nf): |
|
579 |
yield |
|
|
575 | yield ff, None | |
|
580 | 576 | continue |
|
581 | 577 | if s_isdir(st.st_mode): |
|
582 | 578 | if not dirignore(nf): |
|
583 |
for |
|
|
584 |
yield |
|
|
579 | for e in findfiles(f): | |
|
580 | yield e | |
|
585 | 581 | else: |
|
586 | 582 | if nn in known: |
|
587 | 583 | continue |
|
588 | 584 | known[nn] = 1 |
|
589 | 585 | if match(nf): |
|
590 | 586 | if supported(ff, st.st_mode, verbose=True): |
|
591 |
yield |
|
|
587 | yield nn, st | |
|
592 | 588 | elif ff in dc: |
|
593 |
yield |
|
|
589 | yield nf, None | |
|
594 | 590 | |
|
595 | 591 | # step two run through anything left in the dc hash and yield |
|
596 | 592 | # if we haven't already seen it |
|
597 |
for |
|
|
598 |
if |
|
|
593 | for f in util.sort(dc): | |
|
594 | if f in known: | |
|
599 | 595 | continue |
|
600 |
known[ |
|
|
601 |
if imatch( |
|
|
602 |
|
|
|
596 | known[f] = 1 | |
|
597 | if imatch(f): | |
|
598 | try: | |
|
599 | st = lstat(_join(f)) | |
|
600 | if supported(f, st.st_mode): | |
|
601 | yield f, st | |
|
602 | continue | |
|
603 | except OSError, inst: | |
|
604 | if inst.errno not in (errno.ENOENT, errno.ENOTDIR): | |
|
605 | raise | |
|
606 | yield f, None | |
|
603 | 607 | |
|
604 | 608 | def status(self, match, ignored, clean, unknown): |
|
605 | 609 | listignored, listclean, listunknown = ignored, clean, unknown |
@@ -619,7 +623,7 class dirstate(object): | |||
|
619 | 623 | dadd = deleted.append |
|
620 | 624 | cadd = clean.append |
|
621 | 625 | |
|
622 |
for |
|
|
626 | for fn, st in self.walk(match, listunknown, listignored): | |
|
623 | 627 | if fn not in dmap: |
|
624 | 628 | if (listignored or match.exact(fn)) and self._dirignore(fn): |
|
625 | 629 | if listignored: |
@@ -630,25 +634,9 class dirstate(object): | |||
|
630 | 634 | |
|
631 | 635 | state, mode, size, time, foo = dmap[fn] |
|
632 | 636 | |
|
633 | if src == 'm': | |
|
634 | nonexistent = True | |
|
635 | if not st: | |
|
636 | try: | |
|
637 | st = lstat(_join(fn)) | |
|
638 | except OSError, inst: | |
|
639 | if inst.errno not in (errno.ENOENT, errno.ENOTDIR): | |
|
640 | raise | |
|
641 | st = None | |
|
642 | # We need to re-check that it is a valid file | |
|
643 | if st and self._supported(fn, st.st_mode): | |
|
644 | nonexistent = False | |
|
645 | if nonexistent and state in "nma": | |
|
637 | if not st and state in "nma": | |
|
646 | 638 |
|
|
647 | continue | |
|
648 | # check the common case first | |
|
649 | if state == 'n': | |
|
650 | if not st: | |
|
651 | st = lstat(_join(fn)) | |
|
639 | elif state == 'n': | |
|
652 | 640 | if (size >= 0 and |
|
653 | 641 | (size != st.st_size |
|
654 | 642 | or ((mode ^ st.st_mode) & 0100 and self._checkexec)) |
General Comments 0
You need to be logged in to leave comments.
Login now