Patchwork [1,of,7,Series-C] clfilter: peer use repo with "unserved" filter

mail settings
Submitter Pierre-Yves David
Date Jan. 7, 2013, 6:16 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/484/
State Accepted
Headers show


Pierre-Yves David - Jan. 7, 2013, 6:16 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at>
# Date 1357443671 -3600
# Node ID 2778e19ac2892d96a1a1615ca5f20ab0179d6d38
# Parent  ad7cda74337100d933cb7e7902c59117f990c270
clfilter: peer use repo with "unserved" filter

This changeset installs a wide filtering on most repo used as a server. This
remove the need to use `visiblehead`/`visiblebranchmap` function and ensures
that changesets we should not serve are actually never served.

We do not use filtering on hgweb yet as there is still a number of issue to
solve there.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -64,11 +64,11 @@  LEGACYCAPS = MODERNCAPS.union(set(['chan
 class localpeer(peer.peerrepository):
     '''peer for a local repo; reflects only the most recent API'''
     def __init__(self, repo, caps=MODERNCAPS):
-        self._repo = repo
+        self._repo = repo.filtered('unserved')
         self.ui = repo.ui
         self._caps = repo._restrictcapabilities(caps)
         self.requirements = repo.requirements
         self.supportedformats = repo.supportedformats
diff --git a/tests/ b/tests/
--- a/tests/
+++ b/tests/
@@ -23,10 +23,13 @@  class clientpeer(wireproto.wirepeer):
 class serverrepo(object):
     def greet(self, name):
         return "Hello, " + name
+    def filtered(self, name):
+        return self
 def mangle(s):
     return ''.join(chr(ord(c) + 1) for c in s)
 def unmangle(s):
     return ''.join(chr(ord(c) - 1) for c in s)