[PATCH] graphmod: compute revs once (issue4782)

Yuya Nishihara yuya at tcha.org
Mon Sep 7 09:48:03 CDT 2015


On Sun, 06 Sep 2015 17:25:22 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1441585277 25200
> #      Sun Sep 06 17:21:17 2015 -0700
> # Node ID be9e3d1399d1f4a4789ff5c0980d5de48aeb61d2
> # Parent  7187f6e923d55cf6b7e6910d24645f303db671ee
> graphmod: compute revs once (issue4782)
> 
> This makes `hg wip` on my Firefox clone ~4x faster than 3.5.1 (~6.5s to
> ~1.5s). This is after a regression in @ to ~45s.
> 
> Patch suggested by Yuya Nishihara in the bug tracker.
> 
> diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
> --- a/mercurial/graphmod.py
> +++ b/mercurial/graphmod.py
> @@ -259,8 +259,10 @@ def dagwalker(repo, revs):
>  
>          for mpar in mpars:
>              gp = gpcache.get(mpar)
>              if gp is None:
> +                # Only compute revs once.
> +                revs = revset.baseset(revs)
>                  gp = gpcache[mpar] = revset.reachableroots(repo, revs, [mpar])

Oops, maybe I should avoid recreating baseset if it is already a baseset.


More information about the Mercurial-devel mailing list