Patchwork [2,of,3,V4] repoview: add _gethiddenblockers method

login
register
mail settings
Submitter Sean Farley
Date April 4, 2014, 1:22 a.m.
Message ID <fb7fd3f4533923299d52.1396574549@laptop.local>
Download mbox | patch
Permalink /patch/4219/
State Accepted
Commit b0822c23e80a0460fddd278a99a5593a7984fae3
Headers show

Comments

Sean Farley - April 4, 2014, 1:22 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1396573662 18000
#      Thu Apr 03 20:07:42 2014 -0500
# Node ID fb7fd3f4533923299d52f2d64efce39b91a40ab7
# Parent  9ffeca13668d408d58490682492fc372603a2712
repoview: add _gethiddenblockers method

This is a standalone function that will provide the ability for extensions to
wrap.

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -17,10 +17,35 @@  def hideablerevs(repo):
     """Revisions candidates to be hidden
 
     This is a standalone function to help extensions to wrap it."""
     return obsolete.getrevs(repo, 'obsolete')
 
+def _gethiddenblockers(repo):
+    """Get revisions that will block hidden changesets from being filtered
+
+    This is a standalone function to help extensions to wrap it."""
+    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 = {}
+        tagsmod.readlocaltags(repo.ui, repo, tags, {})
+        if tags:
+            blockers.extend(repo[t[0]].rev() for t in tags.values())
+        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."""
     assert not repo.changelog.filteredrevs