[PATCH] graphmod: compute revs once (issue4782)

Gregory Szorc gregory.szorc at gmail.com
Mon Sep 7 00:25:22 UTC 2015


# 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])
             if not gp:
                 parents.append(mpar)
             else:


More information about the Mercurial-devel mailing list