wireproto: only expose "stream_out" to version 1 transports
I have plans to implement stream clone using a better mechanism than
this existing command. Let's not carry it forward to wire protocol
version 2.
Differential Revision: https://phab.mercurial-scm.org/D3201
wireproto: implement capabilities for wire protocol v2
The capabilities mechanism for wire protocol version 2 represents a
clean break from version 1.
Instead of effectively exchanging a set of capabilities, we're
exchanging a rich data structure.
This data structure currently contains information about
every available command, including its accepted arguments. It also
contains information about supported compression formats.
Exposing information about supported commands will allow clients
to automatically generate bindings to the server. Clients will be
able to do things like detect when they are attempting to run a
command that isn't known to the server. Exposing the required
permissions to run a command can be used by clients to determine if
they have privileges to call a command before actually calling it.
We could potentially even have clients send credentials
preemptively without waiting for the server to deny the command
request. Lots of potential here.
The data returned by this command will likely evolve heavily. So we
shouldn't bikeshed the implementation just yet.
Differential Revision: https://phab.mercurial-scm.org/D3200
context: add deprecation warnings for deprecated types of changeids
It's close to code freeze, and dropping support for repo['123'] and
repo ['my-bookmark'] and repo['
deadbeef'] is pretty dispruptive, so
this just adds deprecation warnings so extensions can easily find the
places they need to fix.
Differential Revision: https://phab.mercurial-scm.org/D3197
revsymbol: stop delegating to repo.__getitem__ for unhandled symbols (API)
The only remaining cases where we were delegating unhandled symbols to
repo.__getitem__ should now be when the symbol could not be found. In
that case we just delegated to repo.__getitem__ for the error
message. Let's just copy the error message instead.
If there were any cases where we got e.g. a binary nodeid or an
integer revnum into revsymbol() (e.g. via repo.lookup()), we'd now
start raising an exception instead. That is why this is marked (API).
This affects one test case, but the new behavior seems better to me. I
can't tell if the old behavior was desired or if the test was just
there to document how it happened to work.
Differential Revision: https://phab.mercurial-scm.org/D3196
context: handle partial nodeids in revsymbol()
Similar reasoning as previous patches.
Differential Revision: https://phab.mercurial-scm.org/D3195
context: handle namespaces in revsymbol()
Similar reasoning as previous patches.
Differential Revision: https://phab.mercurial-scm.org/D3194
scmutil: handle full hex nodeids in revsymbol()
This is a bit unfortunate, but it enables moving other pieces out of
changectx's constructor without affecting the order in which we
look up things (e.g. hex nodeid before bookmark).
We convert nodeid to revnum before calling repo.__getitem__, even
though that will result in converting back to nodeid later. This is so
we can handle the LookupError and attempt to interpret the string as
something else (e.g. a bookmark).
We also need to start handling WdirUnsupported now, since the full hex
nodeid "ffff..." represents the working directory. The exception is
raised by the revlog layer.
Differential Revision: https://phab.mercurial-scm.org/D3193
context: handle stringified ints in revsymbol()
This patch copies the handling of stringified ints from changectx's
constructor. It then calls repo.__getitem__ with the int. Since that
method only interprets integers as revnums the first thing it does,
this will not be redoing any of the work already done. We leave the
old code in place so we can later deprecate it instead of breaking
extensions.
Differential Revision: https://phab.mercurial-scm.org/D3146