Patchwork [2,of,2] obscheckhead: skip context creation to test phase

login
register
mail settings
Submitter Pierre-Yves David
Date May 19, 2017, 10:46 a.m.
Message ID <b88f7405eb381246abf6.1495190764@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20706/
State Accepted
Headers show

Comments

Pierre-Yves David - May 19, 2017, 10:46 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1495190114 -7200
#      Fri May 19 12:35:14 2017 +0200
# Node ID b88f7405eb381246abf6e2a6667f60e2612304c7
# Parent  6859efcbf87d071d2c8afab08936bb3995031dcb
# EXP-Topic checkhead-test
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r b88f7405eb38
obscheckhead: skip context creation to test phase

On repository with many many heads, this is called often enough to show an
overhead to appears in some profile. So we skip the 'changectx' creation to test
the node phases.
Augie Fackler - May 19, 2017, 9:43 p.m.
On Fri, May 19, 2017 at 12:46:04PM +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1495190114 -7200
> #      Fri May 19 12:35:14 2017 +0200
> # Node ID b88f7405eb381246abf6e2a6667f60e2612304c7
> # Parent  6859efcbf87d071d2c8afab08936bb3995031dcb
> # EXP-Topic checkhead-test
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r b88f7405eb38
> obscheckhead: skip context creation to test phase

queued, thanks

Patch

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -431,6 +431,7 @@  def _postprocessobsolete(pushop, futurec
     repo = pushop.repo
     unfi = repo.unfiltered()
     tonode = unfi.changelog.node
+    torev = unfi.changelog.rev
     public = phases.public
     getphase = unfi._phasecache.phase
     ispublic = (lambda r: getphase(unfi, r) == public)
@@ -460,8 +461,7 @@  def _postprocessobsolete(pushop, futurec
     while localcandidate:
         nh = localcandidate.pop()
         # run this check early to skip the evaluation of the whole branch
-        if (nh in futurecommon
-                or unfi[nh].phase() <= public):
+        if (nh in futurecommon or ispublic(torev(nh))):
             newhs.add(nh)
             continue