clfilter: make localpeer use a repo with "unserved" filter
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Sun, 06 Jan 2013 04:41:11 +0100
changeset 18278 753acee7d6dd
parent 18277 a58260bc101f
child 18279 679767c38cb5
clfilter: make localpeer use a repo with "unserved" filter This changeset installs a broad filter on most repos used for serving. This removes the need to use the `visiblehead`/`visiblebranchmap` functions, and ensures that changesets we should not serve are in fact never served. We do not use filtering on hgweb yet, as there is still a number of issues to solve there.
mercurial/localrepo.py
tests/test-wireproto.py
--- a/mercurial/localrepo.py	Fri Jan 04 03:16:08 2013 +0100
+++ b/mercurial/localrepo.py	Sun Jan 06 04:41:11 2013 +0100
@@ -66,7 +66,7 @@
 
     def __init__(self, repo, caps=MODERNCAPS):
         peer.peerrepository.__init__(self)
-        self._repo = repo
+        self._repo = repo.filtered('unserved')
         self.ui = repo.ui
         self._caps = repo._restrictcapabilities(caps)
         self.requirements = repo.requirements
--- a/tests/test-wireproto.py	Fri Jan 04 03:16:08 2013 +0100
+++ b/tests/test-wireproto.py	Sun Jan 06 04:41:11 2013 +0100
@@ -25,6 +25,9 @@
     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):