[PATCH 1 of 5] revset: adds onlyroots argument to revsbetween
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Fri Aug 7 02:34:16 CDT 2015
On 08/06/2015 11:10 PM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1434770334 25200
> # Fri Jun 19 20:18:54 2015 -0700
> # Branch stable
> # Node ID dd83ca8e712cec7331a8418600da7c5a8b8cfed0
> # Parent 79f0cb97d7537a7c2948f8f9b0a89148825a3a1d
> revset: adds onlyroots argument to revsbetween
>
> This patch is part of a series of patches to speed up the computation of
> revset.revsbetween by introducing a C implementation. The main motivation is to
> speed up smartlog on big repositories. At the end of the series, on our big
> repositories the computation of revsbetween is 10-50x faster and smartlog on is
> 2x-5x faster.
>
> This patch adds a new argument to revsbetween called onlyroots. This allows us
> to compute grandparent with revsbetween and remove the code of grandparent in
> the next patch.
That patch looks good to me.
I've some reservation about the name, revbetween(onlyroots=False) seems
a bit weird. I would probably invert the logic in the name. Something like:
reachedroots(includepath=True)
However, ss we can change it later, I do not think we should delay this
patch on this.
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -78,7 +78,7 @@
>
> return generatorset(iterate(), iterasc=True)
>
> -def _revsbetween(repo, roots, heads):
> +def _revsbetween(repo, roots, heads, onlyroots=False):
> """Return all paths between roots and heads, inclusive of both endpoint
> sets."""
> if not roots:
> @@ -101,6 +101,8 @@
> rev = nextvisit()
> if rev in roots:
> reached(rev)
> + if onlyroots:
> + continue
Did you benchmark the performance impact of this addition?
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list