diff mercurial/discovery.py @ 32370:8fb5f452e69c

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 19 May 2017 12:35:14 +0200
parents bd872f64a8ba
children 81cbfaea1e0f
line wrap: on
line diff
--- a/mercurial/discovery.py	Fri May 19 02:44:30 2017 +0200
+++ b/mercurial/discovery.py	Fri May 19 12:35:14 2017 +0200
@@ -431,6 +431,7 @@
     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 @@
     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