[PATCH 1 of 6 v6] revlog: add incancestors, a version of ancestors that includes revs listed

Joshua Redstone joshua.redstone at fb.com
Tue Jun 19 15:25:18 CDT 2012


superseded by v8: 
http://article.gmane.org/gmane.comp.version-control.mercurial.devel/51680

On 6/8/12 5:27 PM, "Joshua Redstone" <joshua.redstone at fb.com> wrote:

># HG changeset patch
># User Joshua Redstone <joshua.redstone at fb.com>
># Date 1339167577 25200
># Node ID 2c865a9bca7431eba9de9bcefad0f114f5050ea0
># Parent  d566aa319d5f7c58c69b985b53ff7498f08e53c6
>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 -r d566aa319d5f -r 2c865a9bca74 mercurial/revlog.py
>--- a/mercurial/revlog.py	Mon Jun 04 17:57:57 2012 -0500
>+++ b/mercurial/revlog.py	Fri Jun 08 07:59:37 2012 -0700
>@@ -401,6 +401,14 @@
>                     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.
> 



More information about the Mercurial-devel mailing list