Gregory Szorc <gregory.szorc@gmail.com> [Thu, 01 Feb 2018 16:59:18 -0800] rev 36072
wireprotoserver: move responsetype() out of http handler
This is our last public attribute not part of the protocol
interface!
Differential Revision: https://phab.mercurial-scm.org/D2087
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:22:44 -0800] rev 36071
wireproto: remove unused proto argument from supportedcompengines (API)
In theory, the protocol should be passed to this function. But the
argument isn't being used and it is getting in the way of refactoring.
So let's remove it. We can always add it back later if we need it
again.
Differential Revision: https://phab.mercurial-scm.org/D2086
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 01 Feb 2018 17:12:07 -0800] rev 36070
wireprotoserver: rename getfile() to forwardpayload() (API)
"file" can mean a lot of things. Let's rename the interface
method to something more descriptive.
While I was here, I moved the docs about the payload format to
the implementation of the SSH protocol, because it was lying
about what the HTTP payload looked like.
Differential Revision: https://phab.mercurial-scm.org/D2085
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:24:22 -0800] rev 36069
wireprotoserver: rename _client to client (API)
This method is called in wireproto.py. It should be part of the public
API/interface.
.. api::
The ``_client()`` method of the wire protocol handler interface has
been renamed to ``client()``.
Differential Revision: https://phab.mercurial-scm.org/D2084
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:20:11 -0800] rev 36068
wireprotoserver: remove redirect() and restore() (API)
These methods on the protocol handler interface are no longer used in
core.
.. api::
redirect() and restore() have been removed from the wire protocol
handler interface. Use mayberedirectstdio() instead.
Differential Revision: https://phab.mercurial-scm.org/D2083
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:19:06 -0800] rev 36067
wireproto: use maybecapturestdio() for push responses (API)
The "pushres" and "pusherr" response types currently call
proto.restore() in the HTTP protocol. This completes the pairing
with proto.redirect() that occurs in the @wireprotocommand
functions. (But since the SSH protocol has a no-op redirect(),
it doesn't bother calling restore() because it would also be
a no-op.)
Having the disconnect between these paired calls is very confusing.
Knowing that you must use proto.redirect() if returning a "pushres"
or a "pusherr" is even wonkier.
We replace this confusing code with our new context manager for
[maybe] capturing output.
The "pushres" and "pusherr" types have gained an "output" argument
to their constructor and an attribute to hold captured data. The
HTTP protocol now retrieves output from these objects.
.. api::
``wireproto.pushres`` and ``wireproto.pusherr`` now explicitly
track stdio output.
Differential Revision: https://phab.mercurial-scm.org/D2082
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:17:47 -0800] rev 36066
wireprotoserver: add context manager mechanism for redirecting stdio
Today, proto.redirect() sets up redirecting stdio and proto.restore()
undoes that. The API is a bit wonky because restore() is only
implemented on the HTTP protocol. Furthermore, not all calls to
redirect() are obviously paired with calls to restore(). For
example, the call to restore() for "unbundle" requests is handled
by the response handler for the HTTP protocol.
This commit introduces a new method on the protocol handler interface
to maybe capture stdio. It emits a file object or None depending on
whether stdio capture is used by the transport.
To prove it works, the "pushkey" wire protocol command has been
updated to use the new API.
I'm not convinced this is the best mechanism to capture stdio. I may
need to come up with something better once the new wire protocol
emerges into existence. But it is strictly better than before because
it removes variance in the wire protocol handler interface. It
therefore gets us closer to a unified interface between the SSH and
HTTP transports.
Differential Revision: https://phab.mercurial-scm.org/D2081