clfilter: introduce a "unserver" filtering mode
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 17 Dec 2012 17:12:02 +0100
changeset 18102 3c7b67b76190
parent 18101 a464deecc9dd
child 18103 83cb1a1a705d
clfilter: introduce a "unserver" filtering mode This mode is for repository used as a server. It filter secret and hidden changeset out. It is put to use in later changeset.
mercurial/repoview.py
--- a/mercurial/repoview.py	Thu Dec 20 17:14:07 2012 +0100
+++ b/mercurial/repoview.py	Mon Dec 17 17:12:02 2012 +0100
@@ -7,9 +7,20 @@
 # GNU General Public License version 2 or any later version.
 
 import copy
+import phases
+
+def computeunserved(repo):
+    """compute the set of revision that should be filtered when used a server
+
+    Secret and hidden changeset should not pretend to be here."""
+    assert not repo.changelog.filteredrevs
+    # fast path in simple case to avoid impact of non optimised code
+    if phases.hassecret(repo) or repo.obsstore:
+        return frozenset(repo.revs('hidden() + secret()'))
+    return ()
 
 # function to compute filtered set
-filtertable = {}
+filtertable = {'unserved': computeunserved}
 
 def filteredrevs(repo, filtername):
     """returns set of filtered revision for this filter name"""