comparison tests/test-wireproto.py @ 33806:dedab036215d

wireproto: use new peer interface The wirepeer class provides concrete implementations of peer interface methods for calling wire protocol commands. It makes sense for this class to inherit from the peer abstract base class. So we change that. Since httppeer and sshpeer have already been converted to the new interface, peerrepository is no longer adding any value. So it has been removed. httppeer and sshpeer have been updated to reflect the loss of peerrepository and the inheritance of the abstract base class in wirepeer. The code changes in wirepeer are reordering of methods to group by interface. Some Python code in tests was updated to reflect changed APIs. .. api:: peer.peerrepository has been removed. Use repository.peer abstract base class to represent a peer repository. Differential Revision: https://phab.mercurial-scm.org/D338
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 10 Aug 2017 20:58:28 -0700
parents b47fe9733d76
children 2f7290555c96
comparison
equal deleted inserted replaced
33805:f913e90f15a0 33806:dedab036215d
17 17
18 class clientpeer(wireproto.wirepeer): 18 class clientpeer(wireproto.wirepeer):
19 def __init__(self, serverrepo): 19 def __init__(self, serverrepo):
20 self.serverrepo = serverrepo 20 self.serverrepo = serverrepo
21 21
22 def _capabilities(self): 22 @property
23 def ui(self):
24 return self.serverrepo.ui
25
26 def url(self):
27 return 'test'
28
29 def local(self):
30 return None
31
32 def peer(self):
33 return self
34
35 def canpush(self):
36 return True
37
38 def close(self):
39 pass
40
41 def capabilities(self):
23 return ['batch'] 42 return ['batch']
24 43
25 def _call(self, cmd, **args): 44 def _call(self, cmd, **args):
26 return wireproto.dispatch(self.serverrepo, proto(args), cmd) 45 return wireproto.dispatch(self.serverrepo, proto(args), cmd)
27 46