[PATCH 1 of 7 Series-C] clfilter: peer use repo with "unserved" filter
pierre-yves.david at logilab.fr
pierre-yves.david at logilab.fr
Mon Jan 7 12:16:04 CST 2013
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# 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/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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):
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
self.supportedformats = repo.supportedformats
diff --git a/tests/test-wireproto.py b/tests/test-wireproto.py
--- a/tests/test-wireproto.py
+++ b/tests/test-wireproto.py
@@ -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)
More information about the Mercurial-devel
mailing list