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