Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 17008:553e8f5aba7a
revlog: add incancestors, a version of ancestors that includes revs listed
ancestors() returns the ancestors of revs provided. This func is like
that except it also includes the revs themselves in the total set of
revs generated.
author | Joshua Redstone <joshua.redstone@fb.com> |
---|---|
date | Fri, 08 Jun 2012 07:59:37 -0700 |
parents | d628bcb3a567 |
children | 0c18aed2fcca |
comparison
equal
deleted
inserted
replaced
17007:21e18c608b68 | 17008:553e8f5aba7a |
---|---|
401 continue | 401 continue |
402 if parent not in seen: | 402 if parent not in seen: |
403 visit.append(parent) | 403 visit.append(parent) |
404 seen.add(parent) | 404 seen.add(parent) |
405 yield parent | 405 yield parent |
406 | |
407 def incancestors(self, revs, stoprev=0): | |
408 """Identical to ancestors() except it also generates the | |
409 revisions, 'revs'""" | |
410 for rev in revs: | |
411 yield rev | |
412 for rev in self.ancestors(revs, stoprev): | |
413 yield rev | |
406 | 414 |
407 def descendants(self, revs): | 415 def descendants(self, revs): |
408 """Generate the descendants of 'revs' in revision order. | 416 """Generate the descendants of 'revs' in revision order. |
409 | 417 |
410 Yield a sequence of revision numbers starting with a child of | 418 Yield a sequence of revision numbers starting with a child of |