Wed, 07 Feb 2018 16:29:05 -0800 wireprototypes: move wire protocol response types to new module
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 16:29:05 -0800] rev 36111
wireprototypes: move wire protocol response types to new module We'll be introducing more types as part of wire protocol version 2. These types are shared between the command handling code (in wireproto.py) and the protocol/transport code in wireprotoserver.py. So they need to go in a new module to prevent a cycle. The types are aliased into the wireproto module, so API compatibility is preserved. Differential Revision: https://phab.mercurial-scm.org/D2088
Thu, 01 Feb 2018 16:59:18 -0800 wireprotoserver: move responsetype() out of http handler
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 01 Feb 2018 16:59:18 -0800] rev 36110
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
Wed, 07 Feb 2018 20:22:44 -0800 wireproto: remove unused proto argument from supportedcompengines (API)
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:22:44 -0800] rev 36109
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
Thu, 01 Feb 2018 17:12:07 -0800 wireprotoserver: rename getfile() to forwardpayload() (API)
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 01 Feb 2018 17:12:07 -0800] rev 36108
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
Wed, 07 Feb 2018 20:24:22 -0800 wireprotoserver: rename _client to client (API)
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:24:22 -0800] rev 36107
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
Wed, 07 Feb 2018 20:20:11 -0800 wireprotoserver: remove redirect() and restore() (API)
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:20:11 -0800] rev 36106
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
Wed, 07 Feb 2018 20:19:06 -0800 wireproto: use maybecapturestdio() for push responses (API)
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:19:06 -0800] rev 36105
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
Wed, 07 Feb 2018 20:17:47 -0800 wireprotoserver: add context manager mechanism for redirecting stdio
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:17:47 -0800] rev 36104
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
Wed, 07 Feb 2018 20:17:05 -0800 wireprotoserver: split ssh protocol handler and server
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:17:05 -0800] rev 36103
wireprotoserver: split ssh protocol handler and server We want to formalize the interface for protocol handlers. Today, server functionality (which is domain specific) is interleaved with protocol handling functionality (which conforms to a generic interface) in the sshserver class. This commit splits the ssh protocol handling code out of the sshserver class. Differential Revision: https://phab.mercurial-scm.org/D2080
Wed, 07 Feb 2018 21:04:54 -0800 wireprotoserver: extract SSH response handling functions
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 21:04:54 -0800] rev 36102
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
(0) -30000 -10000 -3000 -1000 -300 -100 -10 +10 +100 +300 +1000 +3000 +10000 tip