Pulkit Goyal <7895pulkit@gmail.com> [Sat, 14 Apr 2018 02:00:43 +0530] rev 37664
py3: make sure curses.tigetstr() first argument is a str
Differential Revision: https://phab.mercurial-scm.org/D3325
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 14 Apr 2018 01:59:55 +0530] rev 37663
py3: use stringutil.forcebytestr() instead of str()
We need to convert errors to bytes using stringutil.forcebytestr()
Differential Revision: https://phab.mercurial-scm.org/D3324
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 14 Apr 2018 01:58:44 +0530] rev 37662
py3: iterate over a copy of dict while changing it
Differential Revision: https://phab.mercurial-scm.org/D3323
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 14 Apr 2018 00:56:44 +0530] rev 37661
py3: use urllib.parse.unquote_plus instead of urllib.unquote_plus
The later is not present in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D3322
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 13 Apr 2018 18:41:56 +0530] rev 37660
py3: add b'' prefixes to tests/test-status-inprocess.py
# skip-blame because just b'' prefixes
Differential Revision: https://phab.mercurial-scm.org/D3321
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 13 Apr 2018 16:31:02 +0530] rev 37659
lock: don't use 'file' as a variable name
Differential Revision: https://phab.mercurial-scm.org/D3320
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 13 Apr 2018 16:30:27 +0530] rev 37658
py3: use b"%d" instead of str() to convert integers to bytes
Differential Revision: https://phab.mercurial-scm.org/D3319
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 12:50:47 -0700] rev 37657
wireproto: expose repository formats via capabilities
Servers need to expose their set of repository storage requirements
in order to facilitate streaming clones (clients need to know
if they are capable of reading the raw storage files that the
server exposes).
Differential Revision: https://phab.mercurial-scm.org/D3335
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 12:49:47 -0700] rev 37656
wireprotoframing: record when new stream is encountered
Without this, we choke after receiving the 2nd frame in a stream.
Not sure how we made it this far without finding this bug.
Differential Revision: https://phab.mercurial-scm.org/D3334
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 12 Apr 2018 13:11:29 -0700] rev 37655
wireprotoframing: use value passed into function
Oops.
Differential Revision: https://phab.mercurial-scm.org/D3333
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 12 Apr 2018 13:08:33 -0700] rev 37654
httppeer: handle error response from client reactor
With this in place, we're now seeing useful errors when running
tests with the new wire protocol enabled!
Differential Revision: https://phab.mercurial-scm.org/D3332
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
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
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
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
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
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
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:45:38 -0700] rev 37647
exchange: use command executor for pushkey
Differential Revision: https://phab.mercurial-scm.org/D3315
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:30:44 -0700] rev 37646
wireproto: use command executor for unbundle
This also required unifying the name of the argument because the
new API always passes arguments by keyword. I decided to change
implementations to "bundle" instead of the interface to "cg"
because "bundle" is more appropriate in a modern world.
Differential Revision: https://phab.mercurial-scm.org/D3314
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 12 Apr 2018 12:33:07 -0700] rev 37645
debugcommands: perform handshake when obtaining httpv2 peer
If we obtain an httpv2peer directly, the instance doesn't have
an API descriptor and therefore doesn't know about the remote's
commands, feature support, etc. This doesn't matter now. But when
we implement the peer so it consults the API descriptor as part
of sending commands, it will.
So we change the logic for obtaining an http version 2 peer to
go through makepeer() so the peer will perform the handshake and
pass the API descriptor to the httpv2peer instance.
Tests changed because we now perform a ?cmd=capabilities when
obtaining version 2 peers.
The Content-Length header is globbed because compression info
will lack zstandard for pure builds.
Differential Revision: https://phab.mercurial-scm.org/D3296
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 11 Apr 2018 18:15:51 -0700] rev 37644
wireproto: rename HTTPV2 so it less like HTTP/2
Per review suggestion on D3230 from Augie.
Differential Revision: https://phab.mercurial-scm.org/D3295
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:21:55 -0700] rev 37643
bundlerepo: use command executor for wire protocol commands
Differential Revision: https://phab.mercurial-scm.org/D3294
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 11 Apr 2018 17:51:40 -0700] rev 37642
bundlerepo: rename "other" to "peer"
Differential Revision: https://phab.mercurial-scm.org/D3293
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:19:39 -0700] rev 37641
bookmarks: use command executor for wire protocol commands
And change the name of a variable to reflect that is is a peer.
Differential Revision: https://phab.mercurial-scm.org/D3292
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:17:45 -0700] rev 37640
hg: use command executor for wire protocol commands
As part of this, I realized that some uses of lookup in a loop
could be converted to use a batch request. But I didn't change
behavior and left in a todo to track potentially changing this.
Differential Revision: https://phab.mercurial-scm.org/D3291
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:14:54 -0700] rev 37639
logexchange: use command executor for wire protocol commands
Differential Revision: https://phab.mercurial-scm.org/D3290
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:14:19 -0700] rev 37638
streamclone: use command executor for wire protocol commands
Differential Revision: https://phab.mercurial-scm.org/D3289
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:13:05 -0700] rev 37637
discovery: use command executor interface
We're trying to port all wire protocol code to use the new
interface so we can implement wire protocol version 2 clients.
Differential Revision: https://phab.mercurial-scm.org/D3288
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 11 Apr 2018 17:24:43 -0700] rev 37636
discovery: don't redundantly call branchmap
We were calling the remote command twice without mutation the
remote in between. Derp.
Differential Revision: https://phab.mercurial-scm.org/D3287
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:12:19 -0700] rev 37635
wireproto: convert legacy commands to command executor
Calls to the legacy commands "changegroup" and "changegroupsubset" have
been ported to the new command executor interface.
Because we always pass arguments by name and not position, some
inconsistent names throughout the code base have been unified.
As part of this change, we no longer had any remaining callers
of the legacy command methods {between, branches, changegroup,
changegroupsubset}. So, these interfaces/methods have been dropped
from peer interfaces. We still have an interface declaring these
methods. But that interface is implemented on the concrete peer
types and isn't part of the generic peer interface. (The
implementations of the command executor continue to call these
methods.)
The ultimate goal is to remove the per-command methods from the
generic peer interface: the only interface-conforming way to
call a command will be with the new executor API. At some point,
we may want to move the methods outside of the peer classes and
change the executor implementations to not call methods directly
on a peer instance.
Differential Revision: https://phab.mercurial-scm.org/D3273