[PATCH 3 of 9 "] discovery: avoid computing identical sets of heads twice

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Mar 5 12:39:14 EST 2019


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1551309132 -3600
#      Thu Feb 28 00:12:12 2019 +0100
# Node ID 82035c1d714f8f3911632ea1271002745fc620f4
# Parent  3a3743e61f7682c7b1b3c8e785e9a69aec9bc07e
# EXP-Topic discovery-speedup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 82035c1d714f
discovery: avoid computing identical sets of heads twice

The very same set of heads is computed in the previous statement, it seems more
efficient to just copy that result.

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -193,7 +193,7 @@ class partialdiscovery(object):
         sample = set(repo.revs('heads(%ld)', revs))
 
         # update from heads
-        revsheads = set(repo.revs('heads(%ld)', revs))
+        revsheads = sample.copy()
         _updatesample(revs, revsheads, sample, repo.changelog.parentrevs)
 
         # update from roots


More information about the Mercurial-devel mailing list