Simon Sapin <simon.sapin@octobus.net> [Mon, 13 Sep 2021 13:45:10 +0200] rev 47960
rust: Add Repo::manifest(revision)
This deduplicates some common code.
Differential Revision: https://phab.mercurial-scm.org/D11407
Simon Sapin <simon.sapin@octobus.net> [Mon, 13 Sep 2021 13:29:55 +0200] rev 47959
rust: Keep lazily-initialized Changelog and Manifest log on the Repo object
That way if one of them is accessed multiple times it won’t be reopened
from the filesystem.
Differential Revision: https://phab.mercurial-scm.org/D11406
Simon Sapin <simon.sapin@octobus.net> [Mon, 13 Sep 2021 13:16:10 +0200] rev 47958
rust: Move lazy initialization of `Repo::dirstate_map` into a generic struct
More components of `Repo` will be added following the same pattern.
Differential Revision: https://phab.mercurial-scm.org/D11405
Simon Sapin <simon.sapin@octobus.net> [Mon, 13 Sep 2021 13:01:25 +0200] rev 47957
rust: Rename Manifest to Manifestlog, ManifestEntry to Manifest
This appears to match the terminology used in Python code
and on https://www.mercurial-scm.org/wiki/Manifest
Differential Revision: https://phab.mercurial-scm.org/D11404
Simon Sapin <simon.sapin@octobus.net> [Thu, 09 Sep 2021 21:04:55 +0200] rev 47956
rust: Add Repo::dirstate_map and use it in `rhg status`
This moves low-level dirstate wrangling out of the status command and into
a more reusable location.
The open dirstate map is lazily initialized and kept on the Repo object,
for reuse by sub-sequent calls.
Differential Revision: https://phab.mercurial-scm.org/D11398
Simon Sapin <simon.sapin@octobus.net> [Fri, 10 Sep 2021 09:53:09 +0200] rev 47955
rust: Switch to the memmap2-rs crate
https://github.com/RazrFalcon/memmap2-rs
This is a fork of the original memmap crate which appears to be unmaintained:
https://github.com/danburkert/memmap-rs/issues/90
This fork is the most popular according to https://crates.io/keywords/mmap
Differential Revision: https://phab.mercurial-scm.org/D11397
Simon Sapin <simon.sapin@octobus.net> [Thu, 09 Sep 2021 18:07:40 +0200] rev 47954
rust: Make OwningDirstateMap generic and move it into hg-core
This will enable using it in rhg too.
The `OwningDirstateMap::new_empty` constructor is generic and accepts a value
of any type that gives acces to a bytes buffer. That buffer must stay valid
as long as the value hasn’t been dropped, and must keep its memory address
even if the value is moved. The `StableDeref` marker trait encodes those
constraints. Previously no trait was needed because the value was always
of type `PyBytes` which we know satisfies those constraints.
The buffer type is ereased in the struct itself through boxing and
dynamic dispatch, in order to simplify other signatures that mention
`OwningDirstateMap`.
Differential Revision: https://phab.mercurial-scm.org/D11396
Simon Sapin <simon.sapin@octobus.net> [Mon, 06 Sep 2021 13:39:54 +0200] rev 47953
rust: Move PyBytesWithData out of copy-tracing code
So we can use it in other places to.
Replace its `.data()` method with the `Deref<Target = [u8]>` trait,
allowing this type to be used in generic contexts.
Rename the type accordingly.
Differential Revision: https://phab.mercurial-scm.org/D11395
Simon Sapin <simon.sapin@octobus.net> [Mon, 06 Sep 2021 11:39:59 +0200] rev 47952
rust: Move VFS code to its own module
It was previously in the hg::repo module, but both repo code and vfs
will likely grow in the future.
Differential Revision: https://phab.mercurial-scm.org/D11394
Simon Sapin <simon.sapin@octobus.net> [Fri, 03 Sep 2021 16:32:35 +0200] rev 47951
rhg: Switch rhg.ignored-extensions config to Python-compatible list syntax
This includes the ability to have an extension name/path that contains a comma,
by double-quoting it.
Differential Revision: https://phab.mercurial-scm.org/D11390
Simon Sapin <simon.sapin@octobus.net> [Wed, 17 Feb 2021 20:49:53 +0100] rev 47950
rhg: Port Python’s `ui.configlist` as `Config::get_list`
This new method is not used yet outside of its own unit tests,
so this changeset should make no observable change.
The Rust parser implementation attempts to exactly replicate the behavior of
the Python one, even in edge cases where that behavior is… surprising.
New unit tests capture some of these edge cases.
This started as a line-by-line port. The main changes are:
* Pass around a parser mode enum instead of parser functions
* Inline the whole parser into one function
* Use `[u8]::get` which returns an `Option`,
instead of indexing after explicitly checking the length.
Differential Revision: https://phab.mercurial-scm.org/D11389
Simon Sapin <simon.sapin@octobus.net> [Fri, 03 Sep 2021 16:37:20 +0200] rev 47949
rust: Generalize the `trim_end_newlines` utility of byte strings
… into `trim_end_matches` that takes a callack.
Also add `trim_start_matches`.
Differential Revision: https://phab.mercurial-scm.org/D11388
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 30 Aug 2021 21:18:29 +0200] rev 47948
dirstate-item: move the C implementation to the same logic
Now that we know were we are going, we can update the C implementation.
Differential Revision: https://phab.mercurial-scm.org/D11387
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 31 Aug 2021 09:23:50 +0200] rev 47947
dirstate-item: introduce low level C function
Since a lot of logic is about to change, we need to isolate it into bits that
are easy reusable in the rest of the C code.
Especially we need to split the part that do the pure logic from the part that
do the Python wrapping.
Differential Revision: https://phab.mercurial-scm.org/D11386
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Aug 2021 20:06:07 +0200] rev 47946
dirstate-item: factor some code in the C implementation
We have both `dirstate_item_from_v1_meth`, a class method, and
`dirstate_item_from_v1_data`, a function taking low level C argument.
Lets implement the former with the later.
Differential Revision: https://phab.mercurial-scm.org/D11385
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Aug 2021 19:19:21 +0200] rev 47945
dirstate-item: `dirstate_item_from_v1_data` replaces make_dirstate_item
For different format, we will need multiple capsule anyways.
Differential Revision: https://phab.mercurial-scm.org/D11384
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 30 Aug 2021 18:45:54 +0200] rev 47944
pathutil: replace the `skip` argument of `dirs` with a boolean
It is ever only used for `r` file. So we make it a boolean this will give use
more versatility later as we will stop storing the state explicitly.
Differential Revision: https://phab.mercurial-scm.org/D11383
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 02 Sep 2021 00:16:37 +0200] rev 47943
dirstate: clarify the message in nonnormal checking
The previous message was quite verbose and hard to understand. The new one
should be friendlier.
Differential Revision: https://phab.mercurial-scm.org/D11382
Augie Fackler <augie@google.com> [Wed, 08 Sep 2021 15:59:48 -0400] rev 47942
merge: with stable
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Fri, 10 Sep 2021 14:57:00 -0400] rev 47941
narrow: fix commits of empty files
The problem is that when committing a new file with empty contents (or
in general empty file with filelog p1 = -1), hg commit with narrow
doesn't create a filelog revision at all, which causes failures in
further commands.
The problem seems to be that:
- hg thinks that instead of creating a new filelog revision, it can
use the filelog's p1 (the nullrev)
- because it thinks the file contents is the same in that revision and
in p1
- because `narrowfilelog.cmp(nullrev, b'')` is True (unlike with
`filelog.cmp`)
It's not clear to me which `cmp` behaves better. But I think it makes
sense to change the commit code to not to "reuse" the null rev when
adding an empty file with filelog p1 == filelog p2 == -1. This is
consistent with never writing the null rev in the manifest, which `hg
verify` claims is an invariant:
```
inside/c@4: manifest refers to unknown revision
000000000000
```
Differential Revision: https://phab.mercurial-scm.org/D11400
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Fri, 10 Sep 2021 14:37:03 -0400] rev 47940
narrow: show repo corruption when commiting empty files
Differential Revision: https://phab.mercurial-scm.org/D11399
Kyle Lippincott <spectral@google.com> [Tue, 07 Sep 2021 11:50:12 -0700] rev 47939
filemerge: be more strict when detecting conflict markers, add `|` markers
I received a user complaint about detecting a line that contained 78 `=`
followed by `*/` as a conflict marker. We'll never generate that, we generate 7
identical characters and either the end of the line, or a space. Let's be
explicit about detecting exactly what we produce to reduce the chances of a
false positive.
While we're here, add `|||||||` as a detected conflict marker (generated with
the `keep-merge3` style conflicts).
Differential Revision: https://phab.mercurial-scm.org/D11391
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Aug 2021 18:00:47 +0200] rev 47938
dirstate-item: implement `v1_mtime` with higher level block
This is much easier to read and maintain.
Differential Revision: https://phab.mercurial-scm.org/D11375
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Aug 2021 17:59:00 +0200] rev 47937
dirstate-item: implement `v1_size` with higher level block
This is much easier to read and maintain.
Differential Revision: https://phab.mercurial-scm.org/D11374
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Aug 2021 17:48:12 +0200] rev 47936
dirstate-item: implement v1_state with higher level block
This is much easier to read and maintain.
Differential Revision: https://phab.mercurial-scm.org/D11373
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Aug 2021 18:04:49 +0200] rev 47935
dirstate-item: add more logic to `from_p2`
This seem semantically better even if this tracking case seems to always comes
with clean_p2 for now.
Differential Revision: https://phab.mercurial-scm.org/D11372
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Aug 2021 17:14:54 +0200] rev 47934
dirstate-item: implement `merged_removed` in a simpler way
We can simply use the underlying attribute.
Differential Revision: https://phab.mercurial-scm.org/D11371
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Aug 2021 17:12:39 +0200] rev 47933
dirstate-item: implement `removed` in a simpler way
We can simply use the underlying attribute.
Differential Revision: https://phab.mercurial-scm.org/D11370
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Aug 2021 17:10:26 +0200] rev 47932
dirstate-item: implement `from_p2_removed` in a simpler way
We can simply use the underlying attribute.
Differential Revision: https://phab.mercurial-scm.org/D11369
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Aug 2021 17:09:49 +0200] rev 47931
dirstate-item: implement `from_p2` in a simpler way
We can simply use the underlying attribute.
Differential Revision: https://phab.mercurial-scm.org/D11368
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Aug 2021 17:09:06 +0200] rev 47930
dirstate-item: implement `merged` in a simpler way
We can simply use the underlying attribute.
Differential Revision: https://phab.mercurial-scm.org/D11367
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 27 Aug 2021 17:07:56 +0200] rev 47929
dirstate-item: implement `added` in a simpler way
We can simply use the underlying attribute.
Differential Revision: https://phab.mercurial-scm.org/D11366