Patchwork [1,of,8] repoview: move '_getdynamicblock' next to 'hideablerevs'

login
register
mail settings
Submitter Pierre-Yves David
Date May 21, 2017, 3:20 p.m.
Message ID <f9c309c4b8d22e0f0a95.1495380036@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20792/
State Accepted
Headers show

Comments

Pierre-Yves David - May 21, 2017, 3:20 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1495302209 -7200
#      Sat May 20 19:43:29 2017 +0200
# Node ID f9c309c4b8d22e0f0a9514f9cd6c4f2096e650be
# Parent  c87db79b95079c3fd0032be7a25cd41567ed11cb
# EXP-Topic dynamicblocker
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r f9c309c4b8d2
repoview: move '_getdynamicblock' next to 'hideablerevs'

There are the two functions that extensions should use to augment the hidding
logic. It seem better to have them together at the top of the file.

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -32,6 +32,25 @@  def hideablerevs(repo):
     lead to crashes."""
     return obsolete.getrevs(repo, 'obsolete')
 
+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."""
+
+    cl = repo.changelog
+    blockers = set()
+    blockers.update([par.rev() for par in repo[None].parents()])
+    blockers.update([cl.rev(bm) for bm in repo._bookmarks.values()])
+
+    tags = {}
+    tagsmod.readlocaltags(repo.ui, repo, tags, {})
+    if tags:
+        rev, nodemap = cl.rev, cl.nodemap
+        blockers.update(rev(t[0]) for t in tags.values() if t[0] in nodemap)
+    return blockers
+
 def _getstatichidden(repo):
     """Revision to be hidden (disregarding dynamic blocker)
 
@@ -73,25 +92,6 @@  def _getstatichidden(repo):
                     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."""
-
-    cl = repo.changelog
-    blockers = set()
-    blockers.update([par.rev() for par in repo[None].parents()])
-    blockers.update([cl.rev(bm) for bm in repo._bookmarks.values()])
-
-    tags = {}
-    tagsmod.readlocaltags(repo.ui, repo, tags, {})
-    if tags:
-        rev, nodemap = cl.rev, cl.nodemap
-        blockers.update(rev(t[0]) for t in tags.values() if t[0] in nodemap)
-    return blockers
-
 cacheversion = 1
 cachefile = 'cache/hidden'