comparison mercurial/wireprotoserver.py @ 35867:d7cce6df65bb

wireprotoserver: remove support for do_<command> handlers (API) Old versions of wire protocol handlers relied on methods named do_<command> to handle wire protocol commands. The last definition of these methods on sshserver was removed by 9f6e0e7ef828 ~2 years ago. I think it's time to not support this mechanism for defining command handlers. .. api:: sshserver no longers looks for wire protocol command handlers in methods named do_<command>. Use @wireproto.wireprotocommand to declare wire protocol command handler functions. Differential Revision: https://phab.mercurial-scm.org/D1985
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 31 Jan 2018 11:17:41 -0800
parents d747cf39cf70
children 5a9ff8c20123
comparison
equal deleted inserted replaced
35866:d747cf39cf70 35867:d7cce6df65bb
342 cmd = self.fin.readline()[:-1] 342 cmd = self.fin.readline()[:-1]
343 if cmd and cmd in wireproto.commands: 343 if cmd and cmd in wireproto.commands:
344 rsp = wireproto.dispatch(self.repo, self, cmd) 344 rsp = wireproto.dispatch(self.repo, self, cmd)
345 self.handlers[rsp.__class__](self, rsp) 345 self.handlers[rsp.__class__](self, rsp)
346 elif cmd: 346 elif cmd:
347 impl = getattr(self, 'do_' + cmd, None) 347 self.sendresponse("")
348 if impl:
349 r = impl()
350 if r is not None:
351 self.sendresponse(r)
352 else:
353 self.sendresponse("")
354 return cmd != '' 348 return cmd != ''
355 349
356 def _client(self): 350 def _client(self):
357 client = encoding.environ.get('SSH_CLIENT', '').split(' ', 1)[0] 351 client = encoding.environ.get('SSH_CLIENT', '').split(' ', 1)[0]
358 return 'remote:ssh:' + client 352 return 'remote:ssh:' + client