equal
deleted
inserted
replaced
1 from __future__ import absolute_import, print_function |
1 from __future__ import absolute_import, print_function |
2 |
2 |
3 from mercurial import ( |
3 from mercurial import ( |
|
4 error, |
4 util, |
5 util, |
5 wireproto, |
6 wireproto, |
|
7 wireprototypes, |
6 ) |
8 ) |
7 stringio = util.stringio |
9 stringio = util.stringio |
8 |
10 |
9 class proto(object): |
11 class proto(object): |
10 def __init__(self, args): |
12 def __init__(self, args): |
40 |
42 |
41 def capabilities(self): |
43 def capabilities(self): |
42 return ['batch'] |
44 return ['batch'] |
43 |
45 |
44 def _call(self, cmd, **args): |
46 def _call(self, cmd, **args): |
45 return wireproto.dispatch(self.serverrepo, proto(args), cmd) |
47 res = wireproto.dispatch(self.serverrepo, proto(args), cmd) |
|
48 if isinstance(res, wireprototypes.bytesresponse): |
|
49 return res.data |
|
50 elif isinstance(res, bytes): |
|
51 return res |
|
52 else: |
|
53 raise error.Abort('dummy client does not support response type') |
46 |
54 |
47 def _callstream(self, cmd, **args): |
55 def _callstream(self, cmd, **args): |
48 return stringio(self._call(cmd, **args)) |
56 return stringio(self._call(cmd, **args)) |
49 |
57 |
50 @wireproto.batchable |
58 @wireproto.batchable |