recover: only apply last journal record per file (
issue6423)
This got broken in 2019 when the size check was introduced. It is most
noticable when dealing with transactions that involve an inline to
non-inline revlog storage transaction. It wasn't seen as much at the
time because the in-memory journal actually de-duplicated the entry
implicity, but since
63edc384d3b7 the on-disk journal is used for
rollback as well as recover.
Differential Revision: https://phab.mercurial-scm.org/D10726
revlog: update data file record before index rename
When migrating from inline to non-inline data storage, the data file is
recorded initially as zero sized so that it is removed on failure. But
the record has to be updated before the index is renamed, otherwise
data is lost on rollback.
Differential Revision: https://phab.mercurial-scm.org/D10725
revlog: fix index computation during inline->non-inline transition
The computation in
63edc384d3b7 failed to factor in the index entries
themselve as revlog.start() doesn't count them. Found by Valtenin
Gatienbaron with a more precise test case from me.
Differential Revision: https://phab.mercurial-scm.org/D10724
dirstate-v2: Change the on-disk format to be tree-shaped
Nodes are stored not only for tracked files but also for their ancestor
directories. A node has "pointers" (byte count from the start of the file)
to its direct child nodes. Everything can be accessed with zero copy.
Differential Revision: https://phab.mercurial-scm.org/D10722
dirstate-tree: Extract into a method sorting children of a given node
A later changset will use this in another place.
This is an associated function (that Python would call static method)
instead of a free function so it doesn’t need to be imported separately.
It’s on `Node` rather than `ChildNodes` because the latter is a type alias
to an external type (`HashMap`) so that would require an extension trait
which needs to be imported separately.
Differential Revision: https://phab.mercurial-scm.org/D10721
dirstate-v2: Add a variant of some tests, that uses the new format
With this, the new format receives some testing every time someone runs tests
with Rust extensions enabled, including on CI.
Differential Revision: https://phab.mercurial-scm.org/D10720
dirstate-v2: Change the on-disk format when the requirement is enabled
For now, the format is the same except with an additional marker at the start.
This marker is redundant: for existing repositories it is `.hg/requires` that
determines which format to use. For new repositories, it is the new
`format.exp-dirstate-v2` config. There is no upgrade or downgrade so far.
Most of the changes are about plumbing a boolean through layers of APIs to
indicate which format should be used.
Differential Revision: https://phab.mercurial-scm.org/D10719
dirstate-v2: Update the expected output of some tests for new requirement
Fix most test failures (except in test-narrow-debugrebuilddirstate.t and
test-upgrade-repo.t) caused by the new entry in config or in .hg/requires
when running `run-tests.py --extra-config-opt format.exp-dirstate-v2=1`
There is no CI so far for this configuration.
Differential Revision: https://phab.mercurial-scm.org/D10718