Patchwork [3,of,7,Series-C] clfilter: filter "unserved" on all wireprotocol commands call

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 7, 2013, 6:16 p.m.
Message ID <3d3f81458983d5d8d577.1357582566@crater2.logilab.fr>
Download mbox | patch
Permalink /patch/482/
State Accepted
Headers show

Comments

Pierre-Yves David - Jan. 7, 2013, 6:16 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1357443453 -3600
# Node ID 3d3f81458983d5d8d577ad0b17840ec952f609b3
# Parent  0435d26ab186b93e4b20e03587a9718ca452e980
clfilter: filter "unserved" on all wireprotocol commands call

This ensure that no unserved changeset are exposed through wire protocol.

Patch

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -344,10 +344,11 @@  class pusherr(object):
 class ooberror(object):
     def __init__(self, message):
         self.message = message
 
 def dispatch(repo, proto, command):
+    repo = repo.filtered("unserved")
     func, spec = commands[command]
     args = proto.getargs(spec)
     return func(repo, proto, *args)
 
 def options(cmd, keys, others):
@@ -360,10 +361,11 @@  def options(cmd, keys, others):
         sys.stderr.write("abort: %s got unexpected arguments %s\n"
                          % (cmd, ",".join(others)))
     return opts
 
 def batch(repo, proto, cmds, others):
+    repo = repo.filtered("unserved")
     res = []
     for pair in cmds.split(';'):
         op, args = pair.split(' ', 1)
         vals = {}
         for a in args.split(','):