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