repoview: skip public parent earlier in _getstatichidden
authorPierre-Yves David <pierre-yves.david@fb.com>
Fri, 03 Apr 2015 14:37:52 -0700
changeset 24681 ad6dea5d96f219ab4cdd12155081b2ba1879dbe6
parent 24680 cde57a8d8fe712942b71db02eb764e3c3f4bb3e3
child 24682 7c6f9097e2e03be6630d782114ac312264f7333a
push id12
push usergszorc@mozilla.com
push dateWed, 15 Apr 2015 21:42:54 +0000
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.
mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -40,29 +40,28 @@ def _getstatichidden(repo):
         getparentrevs = repo.changelog.parentrevs
         # 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)
-            # 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.
 
     Get revisions that will block hidden changesets and are likely to change,
     but unlikely to create hidden blockers. They won't be cached, so be careful
     with adding additional computation."""