Raphaël Gomès <rgomes@octobus.net> [Wed, 04 May 2022 15:49:20 +0200] rev 49158
test-dirstate: print something when the check is skipped
This makes a programming error obvious in cases when it should not be skipped
Differential Revision: https://phab.mercurial-scm.org/D12602
Raphaël Gomès <rgomes@octobus.net> [Wed, 04 May 2022 15:48:13 +0200] rev 49157
test-dirstate: fix detection of Rust environment variable
The Rust path never actually worked. This change also improves clarity of the
comment. The next change will ensure we print something when this check fails.
Differential Revision: https://phab.mercurial-scm.org/D12601
Raphaël Gomès <rgomes@octobus.net> [Thu, 28 Apr 2022 17:15:35 +0200] rev 49156
rust-dirstate-v2: fix the unused bytes counter when rewriting the dirstate
As per the previous patch, the counter was incorrectly carried over from the
old docket when it should be reset for a complete rewrite.
Differential Revision: https://phab.mercurial-scm.org/D12594
Raphaël Gomès <rgomes@octobus.net> [Thu, 28 Apr 2022 17:11:51 +0200] rev 49155
rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite
This was picked up by @aalekseyev when doing unrelated debugging.
The Rust implementation was never resetting this counter, so a brand new file
would carry over the old counter.
As I write this, my counter is a supposed 7389089 unused bytes for a total of
170978 bytes in the data file. Feel free to post your own high score.
Differential Revision: https://phab.mercurial-scm.org/D12593
Raphaël Gomès <rgomes@octobus.net> [Thu, 28 Apr 2022 16:24:55 +0200] rev 49154
test-dirstate: use new `--docket` flag to get the data uuid
This is more robust.
Differential Revision: https://phab.mercurial-scm.org/D12592
Raphaël Gomès <rgomes@octobus.net> [Thu, 28 Apr 2022 15:22:08 +0200] rev 49153
debugcommands: remove `debugdirstateignorepatternhash`
This is replaced by the more complete `--docket` option to `debugstate`.
Differential Revision: https://phab.mercurial-scm.org/D12591
Raphaël Gomès <rgomes@octobus.net> [Thu, 28 Apr 2022 15:19:19 +0200] rev 49152
dirstate-v2: add flag to `debugstate` to print docket information
This is useful information that we don't easily have access to currently,
unless you speak fluent xxd.
This replaces `debugdirstateignorepatternshash`, which I'll remove in the next
changeset.
Differential Revision: https://phab.mercurial-scm.org/D12590
Matt Harbison <matt_harbison@yahoo.com> [Mon, 02 May 2022 22:04:59 -0400] rev 49151
doc: use an absolute path in sys.path to work around a python DLL loading bug
This bug[1] was causing the zstd entry under "Available Compression Engines" to
be omitted from the documentation for some versions of python3. I could
upgrade, but past upgrades have broken venvs and clobbered installed packages.
It's a trivial workaround, so there's no sense in leaving this subtle issue. It
was flushed out by changing the module policy here from 'allow' to 'c', and
seeing this error:
ImportError: DLL load failed while importing parsers: The parameter is incorrect.
[1] https://github.com/python/cpython/issues/87271
Differential Revision: https://phab.mercurial-scm.org/D12599
Raphaël Gomès <rgomes@octobus.net> [Mon, 25 Apr 2022 16:45:03 +0200] rev 49150
rhg: fix dirstate-v2 data file removal system
In D12581 I introduced logic to remove the previous dirstate-v2 data file
after a new one is created (and its corresponding docket), but the logic was
flawed. I fixed it and made it simpler to understand by gather all logic in
a single expression.
Differential Revision: https://phab.mercurial-scm.org/D12586
Raphaël Gomès <rgomes@octobus.net> [Tue, 19 Apr 2022 12:27:40 +0200] rev 49149
rhg: use `Command::exec` instead of `Command::status`
`rhg` is supposed to be a transparent executable, using a subprocess defeats
that purpose. See inline comments for more details.
This also introduces the `which` crate to check if the fallback executable
actually exists to help debugging (plain `execve` doesn't give much
information).
The error code 253 is used to signify that the fallback is not found, but may
mean in the future that it is otherwise invalid if we start being more
specific.
Differential Revision: https://phab.mercurial-scm.org/D12578
Martin von Zweigbergk <martinvonz@google.com> [Wed, 27 Apr 2022 15:47:57 +0200] rev 49148
commit: don't use hard-coded `.hg/last-message.txt` path in error message
Whoever wrote D8463 just used a hard-coded path to
`.hg/last-message.text` instead of using the relative path that was
already available in the `msgfn` variable (and used just a few lines
up in related message). Let's fix that.
Differential Revision: https://phab.mercurial-scm.org/D12585
Raphaël Gomès <rgomes@octobus.net> [Mon, 25 Apr 2022 11:09:33 +0200] rev 49147
branching: merge stable into default
This also added the small fix need in Rust tests for the new
`DirstateMap::pack_v2` API change in stable.
Raphaël Gomès <rgomes@octobus.net> [Thu, 21 Apr 2022 15:10:57 +0200] rev 49146
rust-dirstate-v2: clean up previous data file after the docket is written
This was overlooked before and caused many data files to keep living forever.
We could potentially consider adding a random cleanup of them in case they
slipped through one day.
Differential Revision: https://phab.mercurial-scm.org/D12581
Raphaël Gomès <rgomes@octobus.net> [Thu, 21 Apr 2022 14:47:13 +0200] rev 49145
rust-dirstate-v2: save proper data size if no new data on append
This is currently only triggered with the tests ran with `--rhg` without
`--rust`, by "luck", there probably always was something to write, like an
mtime when also using Rust extensions alongside `rhg`.
Differential Revision: https://phab.mercurial-scm.org/D12580
Kyle Lippincott <spectral@google.com> [Tue, 19 Apr 2022 12:17:23 -0700] rev 49144
amend: move "return None for removed files" into block handling filestoamend
This is just a small logic cleanup from D12573, no change in behavior.
Differential Revision: https://phab.mercurial-scm.org/D12576
Raphaël Gomès <rgomes@octobus.net> [Tue, 12 Apr 2022 17:35:25 +0200] rev 49143
rust-dirstatemap: remove unused helper from the old API
Differential Revision: https://phab.mercurial-scm.org/D12541
Raphaël Gomès <rgomes@octobus.net> [Tue, 12 Apr 2022 17:35:02 +0200] rev 49142
rust-status: stop using `state()` in the dispatch logic
Let's use the new API.
Differential Revision: https://phab.mercurial-scm.org/D12540
Raphaël Gomès <rgomes@octobus.net> [Tue, 12 Apr 2022 17:34:18 +0200] rev 49141
rust-status: stop using `state()` in `handle_normal_file`
Let's use the new API
Differential Revision: https://phab.mercurial-scm.org/D12539
Raphaël Gomès <rgomes@octobus.net> [Tue, 12 Apr 2022 17:30:34 +0200] rev 49140
rust-dirstatemap: stop using `state()` in the cache logic
Let's use the new API
Differential Revision: https://phab.mercurial-scm.org/D12538
Raphaël Gomès <rgomes@octobus.net> [Tue, 12 Apr 2022 16:24:25 +0200] rev 49139
rust-dirstatemap: stop using `.state` in `is_from_other_parent`
This is a deprecated API and will be removed one day.
Differential Revision: https://phab.mercurial-scm.org/D12537
Raphaël Gomès <rgomes@octobus.net> [Tue, 12 Apr 2022 17:29:21 +0200] rev 49138
rust-dirstate-entry: add `modified` method
This will also be used in other places later in the series.
Differential Revision: https://phab.mercurial-scm.org/D12536
Raphaël Gomès <rgomes@octobus.net> [Tue, 12 Apr 2022 17:27:56 +0200] rev 49137
rust: remove use of `EntryState` in `DirsMultiset`
Let's use the new API.
Differential Revision: https://phab.mercurial-scm.org/D12535
Raphaël Gomès <rgomes@octobus.net> [Tue, 12 Apr 2022 17:26:23 +0200] rev 49136
rust: use `entry.tracked()` directly
This is the new API
Differential Revision: https://phab.mercurial-scm.org/D12534
Raphaël Gomès <rgomes@octobus.net> [Tue, 12 Apr 2022 17:25:38 +0200] rev 49135
rust-hg-cpython: remove use of `EntryState`
Let's use the new API
Differential Revision: https://phab.mercurial-scm.org/D12533
Raphaël Gomès <rgomes@octobus.net> [Fri, 08 Apr 2022 18:10:12 +0200] rev 49134
rust-dirstatemap: use a checked sub instead of a potentially underflowing one
This was missed in
2593873cda0f
Differential Revision: https://phab.mercurial-scm.org/D12532
Raphaël Gomès <rgomes@octobus.net> [Fri, 08 Apr 2022 17:55:03 +0200] rev 49133
rust-dirstatemap: add simpler version of `get_node_mut`
This will help reduce code and footgun potential for simpler callers.
Differential Revision: https://phab.mercurial-scm.org/D12531
Raphaël Gomès <rgomes@octobus.net> [Fri, 08 Apr 2022 17:22:39 +0200] rev 49132
rust-dirstatemap: use `get_node_mut` instead or `get_or_insert_node`
This (along with the docstring), makes it more obvious that we're not expecting
to insert a node here. This is less prone to bugs in later refactorings.
Differential Revision: https://phab.mercurial-scm.org/D12530
Raphaël Gomès <rgomes@octobus.net> [Fri, 08 Apr 2022 16:56:52 +0200] rev 49131
rust-dirstatemap: add `each_ancestor` argument to `get_node_mut`
This forces the callers to think about if the counters in the ancestors
need to be adjusted.
Differential Revision: https://phab.mercurial-scm.org/D12529
Raphaël Gomès <rgomes@octobus.net> [Fri, 08 Apr 2022 16:53:06 +0200] rev 49130
rust-dirstatemap: add simpler method `get_or_insert_node` for the common case
All but one case use the exact same input for most arguments, this simplifies
code and reduces footgun potential.
Differential Revision: https://phab.mercurial-scm.org/D12528
Raphaël Gomès <rgomes@octobus.net> [Fri, 08 Apr 2022 16:05:47 +0200] rev 49129
rust-dirstatemap: inline the last `get_or_insert` call
The `get_or_insert` method was dangerous because it did not take the
`DirstateMap` counters into account. This particular instance does not need
to update the counters.
Differential Revision: https://phab.mercurial-scm.org/D12527
Raphaël Gomès <rgomes@octobus.net> [Fri, 08 Apr 2022 16:04:17 +0200] rev 49128
rust-dirstatemap: add `set_cached_mtime` helper method
This will help remove the `get_or_insert` method, which is dangerous because it
does not take the `DirstateMap` counters into account
Differential Revision: https://phab.mercurial-scm.org/D12526
Raphaël Gomès <rgomes@octobus.net> [Fri, 08 Apr 2022 16:03:39 +0200] rev 49127
rust-dirstatemap: add `clear_cached_mtime` helper method
This will help remove the `get_or_insert` method, which is dangerous because it
does not take the `DirstateMap` counters into account.
Differential Revision: https://phab.mercurial-scm.org/D12525
Raphaël Gomès <rgomes@octobus.net> [Tue, 29 Mar 2022 18:21:40 +0200] rev 49126
rust-dirstatemap: add unit tests
These were missing and have already proven valuable since they have found
two bugs (fixed in previous patches).
There may be other behavior to test, but this gives us a decent coverage.
Differential Revision: https://phab.mercurial-scm.org/D12524
Raphaël Gomès <rgomes@octobus.net> [Tue, 29 Mar 2022 17:27:36 +0200] rev 49125
rust: add `Debug` trait to a bunch of structs
This is useful when... debugging. Right now the output is not in the most
readable state it could be, but this is very low effort and is good enough
for now. We may want to write a nicer custom debug formatter for some of those
structs in the future.
Differential Revision: https://phab.mercurial-scm.org/D12523
Raphaël Gomès <rgomes@octobus.net> [Wed, 30 Mar 2022 11:39:53 +0200] rev 49124
rust-dirstatemap: use `&HgPath` instead of `HgPathBuf` in `copy_map_insert`
No reason to require an owned path here.
Differential Revision: https://phab.mercurial-scm.org/D12522
Raphaël Gomès <rgomes@octobus.net> [Tue, 29 Mar 2022 17:23:24 +0200] rev 49123
rust-dirstatemap: use `DirstateEntry::tracked` directly
`state()` is a legacy API that will be removed at some point, let's use the
newer API.
Differential Revision: https://phab.mercurial-scm.org/D12521
Raphaël Gomès <rgomes@octobus.net> [Tue, 29 Mar 2022 00:58:58 +0200] rev 49122
rust-cpython: remove unused API to `drop_entry_and_copy_source`
This is not used anywhere anymore and its use cases are covered by the new API
Differential Revision: https://phab.mercurial-scm.org/D12520
Raphaël Gomès <rgomes@octobus.net> [Tue, 29 Mar 2022 00:57:06 +0200] rev 49121
rust-dirstatemap: remove `set_dirstate_entry`/`set_entry` methods
These methods were needed crutches before the Rust implementation caught up
to Python. Calling `set_entry` (whether from Python or Rust) was dangerous
since it didn't update any of the counters of the DirstateMap data structure,
while having no real way of knowing when to use it "correctly" except it you
were one of the 3 people who looked deep enough into the soul of this code.
Differential Revision: https://phab.mercurial-scm.org/D12519
Raphaël Gomès <rgomes@octobus.net> [Tue, 29 Mar 2022 00:53:11 +0200] rev 49120
rust-dirstatemap: implement part of the `setparents` logic
The Python code does many round-trip calls to the Rust dirstatemap when copy
information needs to be dropped in `setparents`.
This may result in improved performance on `commit`, `update` and other such
commands, but was mostly done to drop the last use of `set_dirstate_item`.
See inline comments for an asterisk about performance, and see next patch for
why `set_dirstate_item` has to go.
Differential Revision: https://phab.mercurial-scm.org/D12518
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 23:45:54 +0200] rev 49119
dirstate-item: add missing bit of docstring
Differential Revision: https://phab.mercurial-scm.org/D12517
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 23:42:16 +0200] rev 49118
dirstatemap: move `_dirs_incr` and `_dirs_decr` methods out of the common
They are only used by the Python implementation now
Differential Revision: https://phab.mercurial-scm.org/D12516
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 23:39:28 +0200] rev 49117
dirstatemap: move `_refresh_entry` out of the common methods
This is only used in the Python implementation now
Differential Revision: https://phab.mercurial-scm.org/D12515
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 23:38:05 +0200] rev 49116
dirstatemap: move `_drop_entry` out of the common methods
Only the Python implementation uses it.
Differential Revision: https://phab.mercurial-scm.org/D12514
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 23:37:36 +0200] rev 49115
rust-dirstatemap: remove `_drop_entry`
This is not used anywhere anymore
Differential Revision: https://phab.mercurial-scm.org/D12513
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 23:34:30 +0200] rev 49114
rust-dirstatemap: remove `__settitem__`
This is not used anywhere now.
Differential Revision: https://phab.mercurial-scm.org/D12512
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 18:30:08 +0200] rev 49113
rust-dirstatemap: remove unused `_refresh_entry` implementation
This was only used in the newer APIs, all of which have been rewritten in Rust
Differential Revision: https://phab.mercurial-scm.org/D12511
Raphaël Gomès <rgomes@octobus.net> [Wed, 23 Mar 2022 17:19:32 +0100] rev 49112
rust-distatemap: remove `addfile` API
All of its users have been migrated to the new API
Differential Revision: https://phab.mercurial-scm.org/D12510
Raphaël Gomès <rgomes@octobus.net> [Wed, 23 Mar 2022 17:16:10 +0100] rev 49111
rust-dirstatemap: remove `removefile` API
Its callers have been migrated to the newer dirstate API.
Differential Revision: https://phab.mercurial-scm.org/D12509
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 18:26:24 +0200] rev 49110
rhg: use the new `set_clean` API
Differential Revision: https://phab.mercurial-scm.org/D12508
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 18:15:11 +0200] rev 49109
dirstatemap: move `set_untracked` out of the common methods
There is a dedicated Rust implementation now
Differential Revision: https://phab.mercurial-scm.org/D12507
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 18:13:58 +0200] rev 49108
rust-dirstatemap: add `set_untracked` method
This is the new API that Python has already migrated to
Differential Revision: https://phab.mercurial-scm.org/D12506
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 18:10:19 +0200] rev 49107
dirstatemap: move `set_possibly_dirty` out of the common methods
There exists now a dedicated Rust implementation
Differential Revision: https://phab.mercurial-scm.org/D12505
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 18:09:01 +0200] rev 49106
rust-dirstatemap: add `set_possibly_dirty` method
This is the new API that Python has already migrated to.
Differential Revision: https://phab.mercurial-scm.org/D12504
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 18:02:45 +0200] rev 49105
dirstatemap: move `set_clean` out of common methods
This now has a dedicated Rust implementation
Differential Revision: https://phab.mercurial-scm.org/D12503
Raphaël Gomès <rgomes@octobus.net> [Mon, 28 Mar 2022 18:02:50 +0200] rev 49104
rust-dirstatemap: add `set_clean` method
This is the new dirstate API that has already been moved to in Python.
Differential Revision: https://phab.mercurial-scm.org/D12502
Raphaël Gomès <rgomes@octobus.net> [Wed, 23 Mar 2022 17:13:18 +0100] rev 49103
dirstatemap: remove `_insert_entry`
This was needed as a compatibility layer for the Python and Rust
implementations, but it is not called from anywhere in Rust anymore.
The two remaining calls have been inlined.
Differential Revision: https://phab.mercurial-scm.org/D12501
Raphaël Gomès <rgomes@octobus.net> [Wed, 23 Mar 2022 17:25:42 +0100] rev 49102
dirstatemap: move `reset_state` out of common methods
Now that we have a Rust implementation, we defer to that accordingly.
Differential Revision: https://phab.mercurial-scm.org/D12500
Raphaël Gomès <rgomes@octobus.net> [Wed, 23 Mar 2022 17:27:58 +0100] rev 49101
rust-dirstatemap: add Rust implementation of `reset_state`
This is the new API which has already been defined in Python
Differential Revision: https://phab.mercurial-scm.org/D12499
Raphaël Gomès <rgomes@octobus.net> [Wed, 23 Mar 2022 17:38:59 +0100] rev 49100
rust-dirstate: introduce intermediate struct for dirstate-v2 data
This is passed often as a long tuple that is not easy to know the form of, so
we refactor everything in this struct.
This also renames `wdir_tracked` to follow the Python `wc_tracked`, even though
the on-disk format uses `WDIR_TRACKED`.
I think a single naming scheme is better, but we can't easily break the Python
impl now because of extensions, so this is low-effort enough and facilitates
grepping.
Differential Revision: https://phab.mercurial-scm.org/D12498
Raphaël Gomès <rgomes@octobus.net> [Wed, 23 Mar 2022 16:32:31 +0100] rev 49099
dirstatemap: remove unused parameter from `reset_state`
This has no callers using it and is not used inside the method itself.
Differential Revision: https://phab.mercurial-scm.org/D12497