Patchwork [3,of,7,V4] clfilter: introduce a "unserver" filtering mode

mail settings
Submitter Pierre-Yves David
Date Dec. 20, 2012, 4:23 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/214/
State Accepted
Commit 3c7b67b7619040bd01368633ea09e91628fde830
Headers show


Pierre-Yves David - Dec. 20, 2012, 4:23 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at>
# Date 1355760722 -3600
# Node ID 92ce40f2bb8a27653c52d2aa43333b9f0c0b19ea
# Parent  54f51cc8f3a34dac96178a873e7aad5ad4fe207a
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.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -5,13 +5,24 @@ 
 # This software may be used and distributed according to the terms of the
 # 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"""
     if filtername not in repo.filteredrevcache:
         func = filtertable[filtername]