Mercurial > hg
diff tests/sshprotoext.py @ 36064:5767664d39a5
wireprotoserver: extract SSH response handling functions
The lookup/dispatch table was cute. But it isn't needed. Future
refactors will benefit from the handlers for individual response
types living outside the class.
As part of this, I snuck in a change that changes a type compare
from str to bytes. This has no effect on Python 2. But it might
make Python 3 a bit happier.
Differential Revision: https://phab.mercurial-scm.org/D2091
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 07 Feb 2018 21:04:54 -0800 |
parents | 48a3a9283f09 |
children | bf676267f64f |
line wrap: on
line diff
--- a/tests/sshprotoext.py Sat Dec 23 15:13:37 2017 +0530 +++ b/tests/sshprotoext.py Wed Feb 07 21:04:54 2018 -0800 @@ -45,11 +45,11 @@ l = self._fin.readline() assert l == b'hello\n' # Respond to unknown commands with an empty reply. - self._sendresponse(b'') + wireprotoserver._sshv1respondbytes(self._fout, b'') l = self._fin.readline() assert l == b'between\n' rsp = wireproto.dispatch(self._repo, self, b'between') - self._handlers[rsp.__class__](self, rsp) + wireprotoserver._sshv1respondbytes(self._fout, rsp) super(prehelloserver, self).serve_forever()