changeset 18102:3c7b67b76190

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.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 17 Dec 2012 17:12:02 +0100
parents a464deecc9dd
children 83cb1a1a705d
files mercurial/repoview.py
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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"""