Mercurial > hg
diff tests/sshprotoext.py @ 36074:2f7290555c96
wireproto: introduce type for raw byte responses (API)
Right now we simply return a str/bytes instance for simple
responses. I want all wire protocol response types to be strongly
typed. So let's invent and use a type for raw bytes responses.
.. api::
Wire protocol command handlers now return a
wireprototypes.bytesresponse instead of a raw bytes instance.
Protocol handlers will continue handling bytes instances. However,
any extensions wrapping wire protocol commands will need to handle
the new type.
Differential Revision: https://phab.mercurial-scm.org/D2089
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 07 Feb 2018 20:27:36 -0800 |
parents | bf676267f64f |
children | 7db243288afb |
line wrap: on
line diff
--- a/tests/sshprotoext.py Wed Feb 07 16:29:05 2018 -0800 +++ b/tests/sshprotoext.py Wed Feb 07 20:27:36 2018 -0800 @@ -49,7 +49,7 @@ l = self._fin.readline() assert l == b'between\n' rsp = wireproto.dispatch(self._repo, self._proto, b'between') - wireprotoserver._sshv1respondbytes(self._fout, rsp) + wireprotoserver._sshv1respondbytes(self._fout, rsp.data) super(prehelloserver, self).serve_forever() @@ -74,7 +74,7 @@ # Send the upgrade response. self._fout.write(b'upgraded %s %s\n' % (token, name)) servercaps = wireproto.capabilities(self._repo, self._proto) - rsp = b'capabilities: %s' % servercaps + rsp = b'capabilities: %s' % servercaps.data self._fout.write(b'%d\n' % len(rsp)) self._fout.write(rsp) self._fout.write(b'\n')