##// END OF EJS Templates
treemanifest: refactor treemanifest.walk()...
Drew Gottlieb -
r24647:fb446c57 default
parent child Browse files
Show More
@@ -623,12 +623,11 b' class treemanifest(object):'
623 yield fn
623 yield fn
624 raise StopIteration
624 raise StopIteration
625
625
626 for fn in self:
626 for fn in self._walk(match):
627 if fn in fset:
627 if fn in fset:
628 # specified pattern is the exact name
628 # specified pattern is the exact name
629 fset.remove(fn)
629 fset.remove(fn)
630 if match(fn):
630 yield fn
631 yield fn
632
631
633 # for dirstate.walk, files=['.'] means "walk the whole tree".
632 # for dirstate.walk, files=['.'] means "walk the whole tree".
634 # follow that here, too
633 # follow that here, too
@@ -638,6 +637,19 b' class treemanifest(object):'
638 if not self.hasdir(fn):
637 if not self.hasdir(fn):
639 match.bad(fn, None)
638 match.bad(fn, None)
640
639
640 def _walk(self, match):
641 '''Recursively generates matching file names for walk().'''
642
643 # yield this dir's files and walk its submanifests
644 for p in sorted(self._dirs.keys() + self._files.keys()):
645 if p in self._files:
646 fullp = self._subpath(p)
647 if match(fullp):
648 yield fullp
649 else:
650 for f in self._dirs[p]._walk(match):
651 yield f
652
641 def matches(self, match):
653 def matches(self, match):
642 '''generate a new manifest filtered by the match argument'''
654 '''generate a new manifest filtered by the match argument'''
643 if match.always():
655 if match.always():
General Comments 0
You need to be logged in to leave comments. Login now