shelve: pick the most recent shelve if none specified for --patch/--stat
Differential Revision: https://phab.mercurial-scm.org/D3950
shelve: improve help text for --patch and --stat
It's not currently obvious why "hg shelve -p" fails, since -p doesn't take an argument.
Differential Revision: https://phab.mercurial-scm.org/D3949
ssh: avoid reading beyond the end of stream when using compression
Compressed streams can be used as part of getbundle. The normal read()
operation of bufferedinputpipe will try to fulfill the request exactly
and can deadlock if the server sends less as it is done. At the same
time, the bundle2 logic will stop reading when it believes it has gotten
all parts of the bundle, which can leave behind end of stream markers as
used by bzip2 and zstd.
To solve this, introduce a new optional unbufferedread interface and
provided it in bufferedinputpipe and doublepipe. If there is buffered
data left, it will be returned, otherwise it will issue a single read
request and return whatever it obtains.
Reorganize the decompression handlers to try harder to read until the
end of stream, especially if the requested read can already be
fulfilled. Check for end of stream is messy with Python 2, none of the
standard compression modules properly exposes it. At least with zstd and
bzip2, decompressing will remember EOS and fail for empty input after
the EOS has been seen. For zlib, the only way to detect it with Python 2
is to duplicate the decompressobj and force some additional data into
it. The common handler can be further optimized, but works as PoC.
Differential Revision: https://phab.mercurial-scm.org/D3937
revset: add larger test for heads(ancestors(…))
It is important to not regress on this benchmark so we move it into the "base"
file. And we add another benchmark with more than two revisions.
revset-benchmark: use a generic revset to test `heads(commonancestors())`
This allow to benchmark revset performance in other repositories than just
the mercurial one.
revlog: reintroduce `revlog.descendant` as deprecated
Reintroduce `revlog.descendant` to help extensions authors update their
extensions in order to use the new API.
context: reintroduce `ctx.descendant` as deprecated
Reintroduce `ctx.descendant` to help extensions authors update their
extensions in order to use the new API.
obsolete: explode if metadata contains invalid UTF-8 sequence (API)
The current metadata API can be a source of bugs since it forces callers to
process encoding conversion by themselves. So let's make it reject bad data
as a last ditch. I assume there's no metadata field which is supposed to store
arbitrary BLOB like transplant_source.
obsolete: store user name and note in UTF-8 (
issue5754) (BC)
Before, user names were stored in local encoding and transferred across
repositories, which made it impossible to restore non-ASCII user names on
different platforms. This patch fixes new markers to be encoded in UTF-8
and decoded back to local encoding when displaying. Existing markers are
unfixable so they may result in mojibake.
I don't like the API that requires metadata dict to be UTF-8 encoded, which
is a source of bugs, but there's no abstraction layer to process the encoding
thingy efficiently. So we apply the same rule as extras dict to obsstore
metadata.