[PATCH 2 of 5] revset: remove grandparent by using revsbetween
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Fri Aug 7 02:37:38 CDT 2015
On 08/06/2015 11:10 PM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1434770932 25200
> # Fri Jun 19 20:28:52 2015 -0700
> # Branch stable
> # Node ID c0fc894d0539cb526724b1cd15488ee6dd9314ff
> # Parent dd83ca8e712cec7331a8418600da7c5a8b8cfed0
> revset: remove grandparent by using 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.
>
> Before this patch, we had a custom computation for grandparent that was very
> close to the idea of revsbetween. This patch expresses grandparent with
> revsbetween to reduce the amount of code.
small nits: I would says "code duplication" instead of "amount of code"
here.
>
> diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
> --- a/mercurial/graphmod.py
> +++ b/mercurial/graphmod.py
> @@ -19,6 +19,7 @@
>
> from mercurial.node import nullrev
> import util
> +import revset
>
> import heapq
>
> @@ -233,8 +234,6 @@
> if not revs:
> return
>
> - cl = repo.changelog
> - lowestrev = revs.min()
> gpcache = {}
>
> if repo.ui.configbool('experimental', 'graph-group-branches', False):
> @@ -256,7 +255,8 @@
> for mpar in mpars:
> gp = gpcache.get(mpar)
> if gp is None:
> - gp = gpcache[mpar] = grandparent(cl, lowestrev, revs, mpar)
> + gp = gpcache[mpar] = revset._revsbetween(repo, revs, [mpar],
> + onlyroots=True)
accessing a private function from a new module is suspicious. Can we
move revbetween elsewhere (or makes it non-private?)
Pretty happy with the patch otherwise.
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list