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

login
register
mail settings
Submitter Pierre-Yves David
Date March 5, 2019, 5:39 p.m.
Message ID <82035c1d714f8f391163.1551807554@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39079/
State Accepted
Headers show

Comments

Pierre-Yves David - March 5, 2019, 5:39 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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