Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlog.py @ 18090:9abc55ef85b5
revlog: move ancestor generation out to a new class
This refactoring is to prepare for implementing lazy membership.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 18 Dec 2012 10:14:01 -0800 |
parents | 717c692fa449 |
children | b280f3bfc8a0 |
line wrap: on
line diff
--- a/mercurial/revlog.py Mon Dec 17 15:57:02 2012 -0800 +++ b/mercurial/revlog.py Tue Dec 18 10:14:01 2012 -0800 @@ -345,31 +345,10 @@ """Generate the ancestors of 'revs' in reverse topological order. Does not generate revs lower than stoprev. - If inclusive is False, yield a sequence of revision numbers starting - with the parents of each revision in revs, i.e., each revision is *not* - considered an ancestor of itself. Results are in breadth-first order: - parents of each rev in revs, then parents of those, etc. - - If inclusive is True, yield all the revs first (ignoring stoprev), - then yield all the ancestors of revs as when inclusive is False. - If an element in revs is an ancestor of a different rev it is not - yielded again. + See the documentation for ancestor.lazyancestors for more details.""" - Result does not include the null revision.""" - visit = util.deque(revs) - seen = set([nullrev]) - if inclusive: - for rev in revs: - yield rev - seen.update(revs) - while visit: - for parent in self.parentrevs(visit.popleft()): - if parent < stoprev: - continue - if parent not in seen: - visit.append(parent) - seen.add(parent) - yield parent + return ancestor.lazyancestors(self, revs, stoprev=stoprev, + inclusive=inclusive) def descendants(self, revs): """Generate the descendants of 'revs' in revision order.