# HG changeset patch # User Joshua Redstone # Date 2012-06-08 14:59:37 # Node ID 553e8f5aba7adbed99d2e70b154ff69fe9881f48 # Parent 21e18c608b68e0c10c8a327537f9ceadbc8c3219 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. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -404,6 +404,14 @@ class revlog(object): seen.add(parent) yield parent + def incancestors(self, revs, stoprev=0): + """Identical to ancestors() except it also generates the + revisions, 'revs'""" + for rev in revs: + yield rev + for rev in self.ancestors(revs, stoprev): + yield rev + def descendants(self, revs): """Generate the descendants of 'revs' in revision order.