Patchwork [6,of,7,V2] repoview: copy blocker code from computehidden

login
register
mail settings
Submitter Sean Farley
Date March 28, 2014, 5:53 p.m.
Message ID <6d11b3a77ddd1f311a68.1396029200@laptop.local>
Download mbox | patch
Permalink /patch/4106/
State Superseded
Headers show

Comments

Sean Farley - March 28, 2014, 5:53 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1396028401 18000
#      Fri Mar 28 12:40:01 2014 -0500
# Node ID 6d11b3a77ddd1f311a6810844f8a3de948563097
# Parent  fa7dce37aac4aaed22ba58a5a86ed886ed5e3a93
repoview: copy blocker code from computehidden

This is just a code copy of the how hidden blockers are currently computed and
will be used in an upcoming patch.

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -20,11 +20,27 @@  def hideablerevs(repo):
 
 def _gethiddenblockers(repo):
     """Get revisions that will block hidden changesets from being filtered
 
     This is a standalone function to help extensions to wrap it."""
-    pass
+    assert not repo.changelog.filteredrevs
+    hideable = hideablerevs(repo)
+    blockers = []
+    if hideable:
+        cl = repo.changelog
+        firsthideable = min(hideable)
+        revs = cl.revs(start=firsthideable)
+        tofilter = repo.revs(
+            '(%ld) and children(%ld)', list(revs), list(hideable))
+        blockers = [r for r in tofilter if r not in hideable]
+        for par in repo[None].parents():
+            blockers.append(par.rev())
+        for bm in repo._bookmarks.values():
+            blockers.append(repo[bm].rev())
+        tags = [n for t, n in repo.localtags().iteritems()]
+        blockers.extend(repo[t].rev() for t in tags)
+    return blockers
 
 def computehidden(repo):
     """compute the set of hidden revision to filter
 
     During most operation hidden should be filtered."""