Martin von Zweigbergk <martinvonz@google.com> [Tue, 28 Jan 2020 10:40:19 -0800] rev 44191
rust: re-format with nightly rustfmt
This fixes test-check-rust-format.t.
Differential Revision: https://phab.mercurial-scm.org/D8025
Matt Harbison <matt_harbison@yahoo.com> [Tue, 28 Jan 2020 22:03:00 -0500] rev 44190
tests: stablize test-rename-merge1.t on Windows
This goes with
d7622fdec3b5.
Differential Revision: https://phab.mercurial-scm.org/D8036
Yuya Nishihara <yuya@tcha.org> [Sat, 21 Sep 2019 17:27:14 +0900] rev 44189
rust-cpython: make sure PySharedRef::borrow_mut() never panics
Since it returns a Result, it shouldn't panic depending on where the
borrowing fails.
PySharedRef::borrow_mut() will be renamed to try_borrow_mut() by the next
patch.
Yuya Nishihara <yuya@tcha.org> [Tue, 22 Oct 2019 11:38:43 +0900] rev 44188
rust-cpython: remove useless wrappers from PyLeaked, just move by map()
This series prepares for migrating to the upstreamed version of PySharedRef.
I found this last batch wasn't queued while rewriting the callers.
While Option<T> was historically needed, it shouldn't be required anymore.
I wasn't aware that each filed can be just moved.
Georges Racinet <georges.racinet@octobus.net> [Mon, 27 Jan 2020 20:28:47 +0100] rev 44187
rust-node: avoid meaningless read at the end of odd prefix
This should be heavily factored out by the CPU branch predictor
anyway.
Differential Revision: https://phab.mercurial-scm.org/D8019
Georges Racinet <georges.racinet@octobus.net> [Fri, 27 Dec 2019 16:06:54 +0100] rev 44186
rust-nodemap: generic NodeTreeVisitor
This iterator will help avoid code duplication when we'll
implement `insert()`, in which we will need to
traverse the node tree, and to remember the visited blocks.
The structured iterator item will allow different usages from
`lookup()` and the upcoming `insert()`.
Differential Revision: https://phab.mercurial-scm.org/D7794
Georges Racinet <georges.racinet@octobus.net> [Fri, 27 Dec 2019 15:11:43 +0100] rev 44185
rust-nodemap: mutable NodeTree data structure
Thanks to the previously indexing abstraction,
the only difference in the lookup algorithm is that we
don't need the special case for an empty NodeTree any more.
We've considered making the mutable root an `Option<Block>`,
but that leads to unpleasant checks and `unwrap()` unless we
abstract it as typestate patterns (`NodeTree<Immutable>` and
`NodeTree<Mutated>`) which seem exaggerated in that
case.
The initial copy of the root block is a very minor
performance penalty, given that it typically occurs just once
per transaction.
Differential Revision: https://phab.mercurial-scm.org/D7793
Georges Racinet <georges.racinet@octobus.net> [Thu, 26 Dec 2019 15:47:14 +0100] rev 44184
rust-nodemap: abstracting the indexing
In the forthcoming mutable implementation, we'll have to visit
node trees that are more complex than a single slice, although
the algorithm will still be expressed in simple indexing terms.
We still refrain using `#[inline]` indications as being
premature optimizations, but we strongly hope the compiler will
indeed inline most of the glue.
Differential Revision: https://phab.mercurial-scm.org/D7792
Georges Racinet <georges.racinet@octobus.net> [Thu, 23 Jan 2020 17:18:13 +0100] rev 44183
rust-nodemap: NodeMap trait with simplest implementation
We're defining here only a small part of the immutable
methods it will have at the end. This is so we can
focus in the following changesets on the needed abstractions
for a mutable append-only serializable version.
The first implementor exposes the actual lookup
algorithm in its simplest form. It will have to be expanded
to account for the missing methods, and the special cases
related to NULL_NODE.
Differential Revision: https://phab.mercurial-scm.org/D7791
Georges Racinet <georges.racinet@octobus.net> [Fri, 27 Dec 2019 23:04:18 +0100] rev 44182
rust-node: handling binary Node prefix
Parallel to the inner signatures of the nodetree functions in
revlog.c, we'll have to handle prefixes of `Node` in binary
form.
Another motivation is that it allows to convert from full Node
references to `NodePrefixRef` without copy. This is expected to
be by far the most common case in practice.
There's a slight complication due to the fact that we'll be sometimes
interested in prefixes with an odd number of hexadecimal digits,
which translates in binary form by a last byte in which only the
highest weight 4 bits are considered. This is totally transparent for
callers and could be revised once we have proper means to measure
performance.
The C implementation does the same, passing the length in nybbles as
function arguments. Because Rust byte slices already have a length, we carry
the even/odd informaton as a boolean, to avoid introducing logical
redundancies and the related potential inconsistency bugs.
There are a few candidates for inlining here, but we refrain from
such premature optimizations, letting the compiler decide.
Differential Revision: https://phab.mercurial-scm.org/D7790