Patchwork [5,of,6] repoview: skip public parent earlier in _getstatichidden

login
register
mail settings
Submitter Pierre-Yves David
Date April 3, 2015, 10:23 p.m.
Message ID <1bc2f01364c0ffb2b204.1428099830@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/8490/
State Accepted
Commit ad6dea5d96f219ab4cdd12155081b2ba1879dbe6
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 1428097072 25200
#      Fri Apr 03 14:37:52 2015 -0700
# Node ID 1bc2f01364c0ffb2b2048d5d35d3c7d03d89caf7
# Parent  a8b5ea29991bd173f34a8fe3aedbbdb336444ce8
repoview: skip public parent earlier in _getstatichidden

Public changeset have nothing to offer regarding hidden changeset. Lets not add
them to the heap at all.

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -41,23 +41,22 @@  def _getstatichidden(repo):
         heapq.heapify(heap)
         heappop = heapq.heappop
         heappush = heapq.heappush
         while heap:
             rev = -heappop(heap)
-            # Skip nodes which are public (guaranteed to not be hidden)
-            if not getphase(repo, rev):
-                continue
             # All children have been processed so at that point, if no children
             # removed 'rev' from the 'hidden' set, 'rev' is going to be hidden.
             blocker = rev not in hidden
             for parent in getparentrevs(rev):
                 if parent == nullrev:
                     continue
                 if blocker:
                     # If visible, ensure parent will be visible too
                     hidden.discard(parent)
-                heappush(heap, -parent)
+                # Skip nodes which are public (guaranteed to not be hidden)
+                if getphase(repo, rev):
+                    heappush(heap, -parent)
     return hidden
 
 def _getdynamicblockers(repo):
     """Non-cacheable revisions blocking hidden changesets from being filtered.