##// END OF EJS Templates
rebase: add potential divergent commit hashes to error message (issue5086)
rebase: add potential divergent commit hashes to error message (issue5086)

File last commit:

r27301:5defcb7d default
r28188:6411140a default
Show More
test-wireproto.py
54 lines | 1.3 KiB | text/x-python | PythonLexer
/ tests / test-wireproto.py
Gregory Szorc
tests: use absolulte_import in test-wireproto.py
r27301 from __future__ import absolute_import
Thomas Arendsen Hein
test-wireprotocol.py: rename to test-wireproto.py for consistency...
r14765 from mercurial import wireproto
class proto(object):
def __init__(self, args):
self.args = args
def getargs(self, spec):
args = self.args
args.setdefault('*', {})
names = spec.split()
return [args[n] for n in names]
Peter Arrenbrecht
peer: introduce real peer classes...
r17192 class clientpeer(wireproto.wirepeer):
Thomas Arendsen Hein
test-wireprotocol.py: rename to test-wireproto.py for consistency...
r14765 def __init__(self, serverrepo):
self.serverrepo = serverrepo
Augie Fackler
batching: migrate basic noop batching into peer.peer...
r25912
def _capabilities(self):
return ['batch']
Thomas Arendsen Hein
test-wireprotocol.py: rename to test-wireproto.py for consistency...
r14765 def _call(self, cmd, **args):
return wireproto.dispatch(self.serverrepo, proto(args), cmd)
@wireproto.batchable
def greet(self, name):
f = wireproto.future()
Augie Fackler
test-wireproto: move from dict() construction to {} literals...
r20686 yield {'name': mangle(name)}, f
Thomas Arendsen Hein
test-wireprotocol.py: rename to test-wireproto.py for consistency...
r14765 yield unmangle(f.value)
class serverrepo(object):
def greet(self, name):
return "Hello, " + name
Pierre-Yves David
clfilter: make localpeer use a repo with "unserved" filter...
r18278 def filtered(self, name):
return self
Thomas Arendsen Hein
test-wireprotocol.py: rename to test-wireproto.py for consistency...
r14765 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)
def greet(repo, proto, name):
return mangle(repo.greet(unmangle(name)))
wireproto.commands['greet'] = (greet, 'name',)
srv = serverrepo()
Peter Arrenbrecht
peer: introduce real peer classes...
r17192 clt = clientpeer(srv)
Thomas Arendsen Hein
test-wireprotocol.py: rename to test-wireproto.py for consistency...
r14765
print clt.greet("Foobar")
b = clt.batch()
Augie Fackler
wireproto: correctly escape batched args and responses (issue4739)...
r25708 fs = [b.greet(s) for s in ["Fo, =;:<o", "Bar"]]
Thomas Arendsen Hein
test-wireprotocol.py: rename to test-wireproto.py for consistency...
r14765 b.submit()
print [f.value for f in fs]