Fri, 13 Apr 2018 12:31:56 -0700 wireproto: add media type to version 2 capabilities response
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 12:31:56 -0700] rev 37653
wireproto: add media type to version 2 capabilities response This is useful to advertise because servers reject unsupported media types. A client may wish to speak multiple media types and choose the one the server supports. I doubt we'll ever use multiple media types or negotiation in core. But during the course of developing this protocol, I may end up making extensions that backport and forward port protocol support as needed to support Mercurial deploys in the wild. e.g. I may deploy support for an older protocol on a server so old clients can continue using it. It's worth pursuing changing the SSH protocol's upgrade mechanism to support multiple media types as well... Differential Revision: https://phab.mercurial-scm.org/D3299
Fri, 13 Apr 2018 12:31:34 -0700 debugcommands: use command executor for invoking commands
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 12:31:34 -0700] rev 37652
debugcommands: use command executor for invoking commands Now that all peers support the command executor interface, we can use it in place of peer._call() (which isn't part of the public API). Tests changed because we are now returning the decoded response instead of the raw bytes. The raw bytes over the wire are already logged. So we're not losing any test coverage. In fact, we're adding test coverage because we're testing decoding of those command responses as well. Differential Revision: https://phab.mercurial-scm.org/D3298
Fri, 13 Apr 2018 12:30:04 -0700 httppeer: implement command executor for version 2 peer
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 12:30:04 -0700] rev 37651
httppeer: implement command executor for version 2 peer Now that we have a new API for issuing commands which is compatible with wire protocol version 2, we can start using it with wire protocol version 2. This commit replaces our hacky implementation of _call() with something a bit more robust based on the new command executor interface. We now have proper support for issuing multiple commands per HTTP request. Each HTTP request maintains its own client reactor. The implementation is similar to the one in the legacy wire protocol. We use a ThreadPoolExecutor for spinning up a thread to read the HTTP response in the background. This allows responses to resolve in any order. While not implemented on the server yet, a client could use concurrent.futures.as_completed() with a collection of futures and handle responses as they arrive from the server. The return value from issued commands is still a simple list of raw or decoded CBOR data. This is still super hacky. We will want a rich data type for representing command responses. But at least this commit gets us one step closer to a proper peer implementation. Differential Revision: https://phab.mercurial-scm.org/D3297
Fri, 13 Apr 2018 11:54:13 -0700 repository: remove ipeercommands from ipeerbase
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:54:13 -0700] rev 37650
repository: remove ipeercommands from ipeerbase AFAICT all callers in core have moved to the commandexecutor interface for invoking wire protocol commands. Or at least they aren't using the named methods on ipeercommands to invoke them. This means we can drop ipeercommands from the ipeerbase interface. As far as interface based programming goes, it is now illegal to call an ipeercommands method for issuing wire protocol commands. However, the methods are still there, so they will still work. At some point we will want to break that API... Differential Revision: https://phab.mercurial-scm.org/D3318
Fri, 13 Apr 2018 12:13:42 -0700 wireproto: properly call clonebundles command
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 12:13:42 -0700] rev 37649
wireproto: properly call clonebundles command We should not be using _call() to make wire protocol calls because it isn't part of the peer API. But clonebundles wasn't part of the supported commands in the peer API! So this commit defines that command in the commands interface, implements it, and teaches the one caller in core to call it using the command executor interface. Differential Revision: https://phab.mercurial-scm.org/D3317
Fri, 13 Apr 2018 11:37:37 -0700 exchange: use command executor for getbundle
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:37:37 -0700] rev 37648
exchange: use command executor for getbundle The code consuming the bundle has been moved to inside the context manager, as that is supposed to be part of the API. (Although it doesn't matter for version 1 peers.) Differential Revision: https://phab.mercurial-scm.org/D3316
(0) -30000 -10000 -3000 -1000 -300 -100 -30 -10 -6 +6 +10 +30 +100 +300 +1000 +3000 +10000 tip