[PATCH 4 of 6] revlog: add functions that use ancestor.lazyancestorset

Kevin Bullock kbullock+mercurial at ringworld.org
Fri Dec 14 14:58:28 CST 2012


On Dec 14, 2012, at 1:35 PM, Siddharth Agarwal wrote:

> # HG changeset patch
> # User Siddharth Agarwal <sid0 at fb.com>
> # Date 1355510978 28800
> # Node ID 530ebaedf4047fbcddef10d98dbb0fb0e68dc7a5
> # Parent  74b0e1f732cf868681ace3e2bc44d5eb54e1729a
> revlog: add functions that use ancestor.lazyancestorset
> 
> [...]
> diff -r 74b0e1f732cf -r 530ebaedf404 mercurial/revlog.py
> --- a/mercurial/revlog.py	Fri Dec 14 11:31:23 2012 -0800
> +++ b/mercurial/revlog.py	Fri Dec 14 10:49:38 2012 -0800
> @@ -369,6 +369,21 @@
>         for rev in self.ancestors(revs, stoprev):
>             yield rev
> 
> +    def ancestorset(self, revs, stoprev=0):
> +        """Return an object that resembles the set of ancestors of revs.
> +
> +        The only operation currently supported is membership (in). The set is
> +        computed lazily starting from tip and working in descending rev
> +        order."""
> +        return ancestor.lazyancestorset(revs, self.parentrevs, False,
> +                                        stoprev=stoprev)
> +
> +    def incancestorset(self, revs, stoprev=0):
> +        """Identical to ancestorset() except it also generates the revisions,
> +        'revs'"""
> +        return ancestor.lazyancestorset(revs, self.parentrevs, True,
> +                                        stoprev=stoprev)
> +

Are these actually going to be useful on _all_ revlogs, or should they go on changelog? So far the only uses I see are on changelog.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list