585 def descendant(self, other): |
585 def descendant(self, other): |
586 """True if other is descendant of this changeset""" |
586 """True if other is descendant of this changeset""" |
587 return self._repo.changelog.descendant(self._rev, other._rev) |
587 return self._repo.changelog.descendant(self._rev, other._rev) |
588 |
588 |
589 def walk(self, match): |
589 def walk(self, match): |
590 fset = set(match.files()) |
590 '''Generates matching file names.''' |
591 # avoid the entire walk if we're only looking for specific files |
591 |
592 if fset and not match.anypats(): |
592 # Override match.bad method to have message with nodeid |
593 if util.all(fn in self for fn in fset): |
593 oldbad = match.bad |
594 for fn in sorted(fset): |
594 def bad(fn, msg): |
595 yield fn |
595 oldbad(fn, _('no such file in rev %s') % self) |
596 raise StopIteration |
596 match.bad = bad |
597 |
597 |
598 for fn in self: |
598 return self._manifest.walk(match) |
599 if fn in fset: |
|
600 # specified pattern is the exact name |
|
601 fset.remove(fn) |
|
602 if match(fn): |
|
603 yield fn |
|
604 # for dirstate.walk, files=['.'] means "walk the whole tree". |
|
605 # follow that here, too |
|
606 fset.discard('.') |
|
607 for fn in sorted(fset): |
|
608 if not self.hasdir(fn): |
|
609 match.bad(fn, _('no such file in rev %s') % self) |
|
610 |
599 |
611 def matches(self, match): |
600 def matches(self, match): |
612 return self.walk(match) |
601 return self.walk(match) |
613 |
602 |
614 class basefilectx(object): |
603 class basefilectx(object): |
1266 def ancestor(self, c2): |
1255 def ancestor(self, c2): |
1267 """return the "best" ancestor context of self and c2""" |
1256 """return the "best" ancestor context of self and c2""" |
1268 return self._parents[0].ancestor(c2) # punt on two parents for now |
1257 return self._parents[0].ancestor(c2) # punt on two parents for now |
1269 |
1258 |
1270 def walk(self, match): |
1259 def walk(self, match): |
|
1260 '''Generates matching file names.''' |
1271 return sorted(self._repo.dirstate.walk(match, sorted(self.substate), |
1261 return sorted(self._repo.dirstate.walk(match, sorted(self.substate), |
1272 True, False)) |
1262 True, False)) |
1273 |
1263 |
1274 def matches(self, match): |
1264 def matches(self, match): |
1275 return sorted(self._repo.dirstate.matches(match)) |
1265 return sorted(self._repo.dirstate.matches(match)) |