Patchwork [5,of,7,clfilter,part,1,V3] clfilter: introduce a "unserver" filtering mode

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 17, 2012, 4:50 p.m.
Message ID <462d2222342c321285d6.1355763014@crater2.logilab.fr>
Download mbox | patch
Permalink /patch/171/
State Superseded, archived
Commit 3c7b67b7619040bd01368633ea09e91628fde830
Headers show

Comments

Pierre-Yves David - Dec. 17, 2012, 4:50 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1355760722 -3600
# Node ID 462d2222342c321285d62cb8cfd6e2138af6a9cf
# Parent  d10c9ab644540f1ccc8256d1c5bbb2920cdbd9df
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.

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -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
-computefiltered = {}
+computefiltered = {'unserved': computeunserved}
 
 def filteredrevs(repo, filtername):
     """returns set of filtered revision for this filter name"""
     if filtername not in repo.revsfiltercache:
         func = computefiltered[filtername]