##// END OF EJS Templates
exchange: support for streaming clone bundles...
exchange: support for streaming clone bundles Now that we have a mechanism to produce and consume streaming clone bundles, we need to teach the human-facing bundle specification parser and the internal bundle file header reading code to be aware of this new format. This patch does so. For the human-facing bundle specification, we choose the name "packed" to describe "streaming clone bundles" because the bundle is essentially a "pack" of raw revlog files that are "packed" together. There should probably be a bikeshed over the name, especially since it is human facing.

File last commit:

r25912:cbbdd085 default
r26756:9e272a96 default
Show More
test-wireproto.py
52 lines | 1.2 KiB | text/x-python | PythonLexer
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]
class clientpeer(wireproto.wirepeer):
def __init__(self, serverrepo):
self.serverrepo = serverrepo
def _capabilities(self):
return ['batch']
def _call(self, cmd, **args):
return wireproto.dispatch(self.serverrepo, proto(args), cmd)
@wireproto.batchable
def greet(self, name):
f = wireproto.future()
yield {'name': mangle(name)}, f
yield unmangle(f.value)
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)
def greet(repo, proto, name):
return mangle(repo.greet(unmangle(name)))
wireproto.commands['greet'] = (greet, 'name',)
srv = serverrepo()
clt = clientpeer(srv)
print clt.greet("Foobar")
b = clt.batch()
fs = [b.greet(s) for s in ["Fo, =;:<o", "Bar"]]
b.submit()
print [f.value for f in fs]