Patchwork [4,of,6] repoview: directly skip public head in _getstatichidden

login
register
mail settings
Submitter Pierre-Yves David
Date April 3, 2015, 10:23 p.m.
Message ID <a8b5ea29991bd173f34a.1428099829@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/8489/
State Accepted
Commit cde57a8d8fe712942b71db02eb764e3c3f4bb3e3
Headers show

Comments

Pierre-Yves David - April 3, 2015, 10:23 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1428096965 25200
#      Fri Apr 03 14:36:05 2015 -0700
# Node ID a8b5ea29991bd173f34a8fe3aedbbdb336444ce8
# Parent  52464cbacdf048fa115caa7109baff6f2631211c
repoview: directly skip public head in _getstatichidden

Public head have nothing to offer regarding hidden stuff, let's skip them.

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -34,11 +34,12 @@  def _getstatichidden(repo):
     assert not repo.changelog.filteredrevs
     hidden = set(hideablerevs(repo))
     if hidden:
         getphase = repo._phasecache.phase
         getparentrevs = repo.changelog.parentrevs
-        heap = [-r for r in repo.changelog.headrevs()]
+        # Skip heads which are public (guaranteed to not be hidden)
+        heap = [-r for r in repo.changelog.headrevs() if getphase(repo, r)]
         heapq.heapify(heap)
         heappop = heapq.heappop
         heappush = heapq.heappush
         while heap:
             rev = -heappop(heap)