clfilter: introduces a hidden filter
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 07 Jan 2013 19:24:06 +0100
changeset 18242 e4687edec014
parent 18241 f5ed27c51995
child 18243 b3b1b8e127e5
clfilter: introduces a hidden filter This filter exclude all hidden revision. We plan to use this filter to hide revision instead of manually checking contents of the hidden revisions set.
mercurial/repoview.py
tests/test-phases.t
--- a/mercurial/repoview.py	Fri Jan 04 19:24:32 2013 +0100
+++ b/mercurial/repoview.py	Mon Jan 07 19:24:06 2013 +0100
@@ -9,6 +9,16 @@
 import copy
 import phases
 
+
+def computehidden(repo):
+    """compute the set of hidden revision to filter
+
+    During most operation hidden should be filtered."""
+    assert not repo.changelog.filteredrevs
+    if repo.obsstore:
+        return frozenset(repo.revs('hidden()'))
+    return frozenset()
+
 def computeunserved(repo):
     """compute the set of revision that should be filtered when used a server
 
@@ -20,14 +30,16 @@
     return frozenset()
 
 # function to compute filtered set
-filtertable = {'unserved': computeunserved}
+filtertable = {'hidden': computehidden,
+               'unserved': computeunserved}
 ### Nearest subset relation
 # Nearest subset of filter X is a filter Y so that:
 # * Y is included in X,
 # * X - Y is as small as possible.
 # This create and ordering used for branchmap purpose.
 # the ordering may be partial
-subsettable = {None: 'unserved'}
+subsettable = {None: 'hidden',
+               'hidden': 'unserved'}
 
 def filteredrevs(repo, filtername):
     """returns set of filtered revision for this filter name"""
--- a/tests/test-phases.t	Fri Jan 04 19:24:32 2013 +0100
+++ b/tests/test-phases.t	Mon Jan 07 19:24:06 2013 +0100
@@ -176,9 +176,9 @@
 check that branch cache with "unserved" filter are properly computed and stored
 
   $ ls ../push-dest/.hg/cache/branchheads*
-  ../push-dest/.hg/cache/branchheads
+  ../push-dest/.hg/cache/branchheads-hidden
   ../push-dest/.hg/cache/branchheads-unserved
-  $ cat ../push-dest/.hg/cache/branchheads
+  $ cat ../push-dest/.hg/cache/branchheads-hidden
   6d6770faffce199f1fddd1cf87f6f026138cf061 6
   b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e default
   2713879da13d6eea1ff22b442a5a87cb31a7ce6a default