Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 04:02:36 +0100] rev 50085
localrepo: stop doing special dirstate backup at transaction open
Since the dirstate writes are already managed by the transaction, we already do
a backup of the dirstate when necessary (and even trigger one to keep `hg
rollback` happy).
We needs some special code to deal with the initial empty checkout, but it is
not too complicated.
Managing variable filename (as dirstate-v2 uses) at the "journalfile" level, is
complex and fragile (which is consistent with the fact these files are not
journal…). If we no longer do it, our life is significantly simpler.
In some sense, we apply the xkcd-1134¹ solution to our savebackup/restorebackup
problem.
[1] https://xkcd.com/1134/
(the change to test-hardlink are expect as decreasing the number of duplicated
backup drive the hardlink count down)
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 11:42:43 +0100] rev 50084
localrepo: "blindly" do a dirstate backup at the end of the transaction
Having the file backup mechanism dealing with file backup as benefit. So lets
move closer to that.
The fact `hg rollback` even needs this is sad. I hope to have the time to
implement one of the alternative soon.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 17:12:21 +0100] rev 50083
test-hardlink: stop explicitly listing `undo.dirstate`
The files is on its way out.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 04:04:40 +0100] rev 50082
localrepo: enforce a clean dirstate when the transaction open
This is important to simplify the backup process. This also seems like a quite
reasonable expectation. See inline documentation for details.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 10:43:22 +0100] rev 50081
dirstate: explicitly backup the datafile
Since the transaction does not know about this file, we need to explicitly mark
it for backup before touching it.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 04:41:38 +0100] rev 50080
mq: write the dirstate before stripping
I am not certain why it is dirty (probably the `repo.setparent` call a right
before. However I know we need it flushed before the repository starts to be
stripped.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 03:08:00 +0100] rev 50079
dirstate: simplify the shelve hack to not go through the disk
We already have the data in memory, so why not simply keep the data in memory?
This avoid abusing the `savebackup/restorebackup` logic and will make our life
easier.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 20:33:14 +0100] rev 50078
test: fix the flakyness in test-remotefilelog-local.t
I now get about 80% of my `test-chg` CI run that fails on flakyness in this
tests.
It turns out this is only ambiguous status that end up doing file download. So…
calling status early will do that potential download separately and the calls we
scrutinize during that test will be just fine.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 02:44:07 +0100] rev 50077
dirstate: detect potential fishy transaction patterns while changing
If we rely on the transaction more, we should be more careful about the
transaction. Adding extra security seems reasonable.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 02:34:54 +0100] rev 50076
dirstate: generalize the dirstate's invalidation on transaction abort
The previous code was too specific, we should add the invalidation at next to
the `addfilegenerator` in the `write` call.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 02:22:13 +0100] rev 50075
dirstate: simplify some methods' decorator
Since `changing_parents` and `changing_files` are mutually exclusive, having
both `@requires_changing_files` and `@requires_not_changing_parents` on a method
is redundant.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 02:19:56 +0100] rev 50074
dirstate: document the functions that need consolidation
They are more functions that make the dirstate dirty but does not currently
enforce a clean change scoping, we add comments in front of each of them so
clarify this. There is no urgency to it, but the world will be a better place
when all of them have proper scoping in place.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 05:03:28 +0100] rev 50073
dirstate: make `restorebackup` more robust when it is a noop
If there are no data_file, we might not be able to determine its filename.
Which can be safely ignored.
(all this code is on the way out anyway)
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 00:33:15 +0100] rev 50072
dirstate-guard: remove the feature
The dirstate guard duplicated some of the logic already implemented in the
transaction (and now the changing_* context).
However the feature was incomplete, for example, living only in memory meant we
could not recover from the hardest crash. In addition this duplicated with the
transaction logic meant things could go out of sync or step on each other.
Removing the feature now that we no longer needs it seems the safest.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 00:14:21 +0100] rev 50071
rollback: remove the dirstateguard usage
Thanks to the previous changeset, we no longer needs it.
begone !
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 10:00:59 +0100] rev 50070
rollback: explicitly skip dirstate rollback when applicable
instead of letting the transaction logic overwrite the dirstate and then
overwrite that overwrite with a backup. We simply do not restore the dirstate
related file during the _playback call.
This open the way to removing the last dirstate guard usage.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 00:26:24 +0100] rev 50069
rollback: detect "parentgone" case earlier
Detecting this earlier will help us to affect the rollback process sooner, which
will help the next changesets.
To keep things simple, we degrade the behavior a bit when the `undo.desc` is
missing. However since `hg rollback` is not supposed to be used and the
`undo.desc` file have been introduced in mercurial 1.6 (2010). I think this is
an acceptable evil.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Feb 2023 23:39:10 +0100] rev 50068
rollback: avoid a `hg commit --addremove` at a critical point
The rollback behavior around `hg commit --addremove` has changed slightly. It
does not really matters here but keeping that variant out of the way cannot
hurt.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Feb 2023 20:48:51 +0100] rev 50067
rollback: display some graphlog before/after a test piece
This make the situation clearer.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Feb 2023 20:47:08 +0100] rev 50066
rollback: show that the safety works in a associated test
That test section is checking that --force is overcoming the safety check,
however we did not check that the safety properly detect the situation.
We now do for clarity.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 14 Feb 2023 00:40:27 +0100] rev 50065
dirstate-guard: remove its usage in `backout`
We can simply replace it with a transaction.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 14 Feb 2023 00:42:00 +0100] rev 50064
dirstate-guard: remove the usage in `import`
It is now redundant with the transaction spawning the same scope.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 14 Feb 2023 00:39:49 +0100] rev 50063
dirstate-guard: replace a usage in `rebase` with a transaction
Opening the transaction sooner will provide us with the same benefit.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 14 Feb 2023 00:31:41 +0100] rev 50062
dirstate-guard: remove usage in `rebase`
Now that the dirstate change and write are clearer, it does not seems we need to
use a dirstate-guard here anymore. The transaction already wrap the full
operation.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 14 Feb 2023 00:31:23 +0100] rev 50061
dirstate-guard: remove it usage in `mq`
The code it covered is also covered by a `changing_parents` context.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 26 Jan 2023 17:46:54 +0100] rev 50060
dirstate: enforce the use of `changing_files` context to change tracking
Now that everything is using the new context, we can start enforcing its usage.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 03:55:14 +0100] rev 50059
dirstate: warn if we write to the dirstate without holding the wlock
Writing the dirstate without holding the wlock can race with other update and
overwrite important change. The comment questionning the current state of
things was right, we should the `wlock` should always cover the dirstate.
(Yes, this is me, agreeing with myself, half a decade later).
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Feb 2023 21:31:37 +0100] rev 50058
dirstate: avoid transaction backup/restore if we do not hold the lock
Doing overwriting the dirstate content without holding the lock is a recipe for
disaster.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 09:59:22 +0100] rev 50057
dirstate: issue a developer warning on implicit write on wlock release
Our goal is to get rid of all these to clarify the writing pattern, so it is
time to warn about this (and later, forbid it).
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Feb 2023 23:29:04 +0100] rev 50056
status: fix post status invalidation
If the dirstate changed under us, we should throw away what we have a reload it,
should we not ?
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Feb 2023 23:28:20 +0100] rev 50055
status: fix post status writing
With dirstate-v2, the status process itself might update internal states. So we
make sure this get written on disk
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Dec 2022 02:54:06 +0100] rev 50054
dirstate: use `dirstate.change_files` to scope the change in `shelve`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Dec 2022 03:04:58 +0100] rev 50053
dirstate: use `dirstate.change_files` to scope the change in `unshelve`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 15 Dec 2022 06:22:23 +0100] rev 50052
shelve: adjust what happens in some `changing_parents` context
It seems like the rest is more about changing tracked_files, so we let start
with moving them out of the `changing_parents` contexts.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 13 Feb 2023 23:29:30 +0100] rev 50051
dirstate: use `dirstate.change_files` to scope the change in `lfconvert`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 05 Feb 2023 12:09:52 +0100] rev 50050
largefiles: rely on main scoping for writing dirstate in `markcommitted`
Yeah, cleaner code.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 05 Feb 2023 12:05:23 +0100] rev 50049
largefiles: rely on main scoping for writing dirstate in `mergeupdate`
Yeah, cleaner code.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 04 Feb 2023 16:54:46 +0100] rev 50048
largefiles: rely on the higher level `changing_giles` in `mergerecordupdates`
Now that context open on the main dirstate also affect the underlying one, we
can skip opening our own in `mergerecordupdates`
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Dec 2022 00:46:58 +0100] rev 50047
dirstate: use wlock and `dirstate.change_files` to scope the change in `mq`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 25 Jan 2023 12:51:26 +0100] rev 50046
subrepo: use `changing_files` context in subrepository code
This is better, not ideal, but better.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 04 Feb 2023 12:14:19 +0100] rev 50045
subrepo: let black expand some call on multiple lines early
newer version of black are righfully doing this, so I apply it before more
semantic change to reduce noise in the next changeset.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Dec 2022 00:43:24 +0100] rev 50044
dirstate: use `dirstate.change_files` to scope the change in `import`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Dec 2022 00:52:06 +0100] rev 50043
dirstate: use `dirstate.change_files` to scope the change in `automv`
This is... mostly... the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 14 Dec 2022 00:47:22 +0100] rev 50042
dirstate: use `dirstate.change_files` to scope the change in `amend`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 25 Jan 2023 12:46:46 +0100] rev 50041
dirstate: use the `changing_files` context in the `keyword` demo
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 25 Jan 2023 12:56:26 +0100] rev 50040
dirstate: wrap repository change in appropriate context in `test-context`
We need the `wlock` (to add files), the `lock` (to commit), a `transaction` (to
commit) and a `changing_files` context (to add files).
Strictly speaking, we could let the commit take the `lock` and create a
`transaction`, but it seems more consistent that way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 25 Jan 2023 12:57:52 +0100] rev 50039
dirstate: use wlock and changing_files context in `test-revlog-ancestry`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 15:01:59 +0100] rev 50038
dirstate: use `dirstate.change_files` to scope the change in `revert`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 25 Jan 2023 12:46:22 +0100] rev 50037
dirstate: use `dirstate.change_files` to scope the change in `gpg`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 16:57:41 +0100] rev 50036
dirstate: use `dirstate.change_files` to scope the change in `tag`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 31 Jan 2023 00:05:12 +0100] rev 50035
dirstate: use `dirstate.change_files` to scope the change in `rename`
This is the way, unless we are not actually touching the working copy.
In such cases we don't need to do something.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 31 Jan 2023 00:08:53 +0100] rev 50034
dirstate: use `dirstate.change_files` to scope the change in `copy`
This is the way, unless we are not actually touching the working copy.
In such cases we don't need to do something.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 16:29:30 +0100] rev 50033
dirstate: use `dirstate.change_files` to scope the change in `remove`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 16:27:57 +0100] rev 50032
dirstate: use `dirstate.change_files` to scope the change in `forget`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 15:07:32 +0100] rev 50031
dirstate: use `dirstate.change_files` to scope the change in `addremove`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 12:57:38 +0100] rev 50030
dirstate: use `dirstate.change_files` to scope the change in `add`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Feb 2023 11:51:58 +0100] rev 50029
commit: use `dirstate.change_files` to scope the associated `addremove`
This was significantly more complicated than I expected, because multiple
extensions get in the way.
I introduced a context that lazily open the transaction and associated context
to work around these complication. See the inline documentation for details.
Introducing the wrapping transaction remove the need for dirstate-guard (one of
the ultimate goal of all this), and slightly affect the result of a `hg
rollback` after a `hg commit --addremove`. That last part is deemed fine. It
aligns the behavior with what happens after a failed `hg commit --addremove` and
nobody should be using `hg rollback` anyway.
The small output change in the test come from the different transaction timing
and fact the transaction now backup the dirstate before the addremove, which
might mean "no file to backup" when the repository starts from an empty state.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 05 Feb 2023 15:38:23 +0100] rev 50028
commit: move the addremove logic around to make the next changeset clearer
Lets do the noise now, without changing any thing. So the new changeset can
focus on the actual semantic changes.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Feb 2023 10:46:46 +0100] rev 50027
largefiles: link the core dirstate._changing context to the lfdirstate one
This will be much cleaner and safer to make sure the two dirstates are in sync.
This way, the large-files dirstate will simply inherit the state of the main
dirstate, so if the core code does the right thing, the large-files code should
be right too.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 26 Jan 2023 17:44:27 +0100] rev 50026
dirstate: add a context for tracking files change
Let us start to use it. We will enforce it later.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 13 Feb 2023 21:51:45 +0100] rev 50025
dirstate: invalidate the dirstate change on transaction failure
If the change context lives inside a transaction, the change are not flushed to
disk on exit as this is delegated to the transaction. As a result we should
also delegate the part that do cleanup on failure.
The issue was caught by tests with other change, but it seems useful to fix this
as soon as possible.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 26 Jan 2023 17:16:24 +0100] rev 50024
dirstate: factor the "changing" context logic out
This makes it reusable for other types of changes.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 26 Jan 2023 15:50:45 +0100] rev 50023
dirstate: introduce a `is_changing_any` property
This will embrace other cases than changing parents.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 30 Jan 2023 19:21:34 +0100] rev 50022
dirstate: rename `pendingparentchange` to `is_changing_parents`
This is clearer and more inline witht he other change we did.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 26 Jan 2023 15:50:36 +0100] rev 50021
dirstate: rename _parentwriters to _changing_level
We will have context for changing more than parents, so lets be prepared.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 05 Feb 2023 12:14:45 +0100] rev 50020
largefiles: remove the `changing_parents` context in `openlfdirstate`
This code might run in any kind of change context, we should rely on the higher
level context instead of opening our own.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Feb 2023 00:57:16 +0100] rev 50019
largefiles: remove the second `changing_parents` in `updatelfiles`
Now that the `update_file` call have been migrated, we can drop the
semantically-wrong `changing_parents` context.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Feb 2023 00:55:44 +0100] rev 50018
largefiles: remove the first `changing_parents` in `updatelfiles`
Now that the `update_file` call have been migrated, we can drop the
semantically-wrong `changing_parents` context.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 05 Feb 2023 09:25:23 +0100] rev 50017
largefiles: use `hacky_extension_update_file` in `updatelfiles`
This is what the function is meant for.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 05 Feb 2023 08:38:43 +0100] rev 50016
largefiles: use `hacky_extension_update_file` in `synclfdirstate`
This is what the function is meant for.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 05 Feb 2023 08:37:33 +0100] rev 50015
largefiles: use `hacky_extension_update_file` in `openlfdirstate`
This is what the function is meant for.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 04 Feb 2023 09:08:26 +0100] rev 50014
win32text: make the hacky call cover more cases
Now that I understand what this is doing, It seems like the case for
`p1_tracked` were covered by neither the code nor the test.
Now the code cover it at least.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 25 Jan 2023 12:47:55 +0100] rev 50013
win32text: drop the `changing_parents` context in revert upgrade
We are not changing parents here, so let us not pretend we do.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Feb 2023 00:29:39 +0100] rev 50012
win32text: clean up and clarify the post-revert hack of dirstate
The change is unrelated to changing parents and should not be a in a
"changing_parents" context. This call is quite hacky, but now it is at least
explicitly hacky.
We will drop the `changing_parents` context in the next changesets, but we kept
this change simple to help readability.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Feb 2023 00:26:08 +0100] rev 50011
dirstate: introduce a `hacky_extension_update_file` method
See inline documentation for details.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 07 Feb 2023 09:36:35 +0100] rev 50010
mq: properly take the wlock during the full qfold operation
Otherwise the operation could be raced… for unknown result.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 04 Feb 2023 11:46:57 +0100] rev 50009
locking: hold the wlock for the full duration of the "keyword demo"
The risk of racing the demo is low, since it seems to create its own repository
on the fly. However it is clearer and more consistent.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 05 Feb 2023 16:54:26 +0100] rev 50008
locking: grab the wlock before touching the dirstate in `perfdirstatewrite`
If we touch the dirstate, we should hold the `wlock`.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 04:22:19 +0100] rev 50007
locking: take the `wlock` for the full `hg addremove` duration
Otherwise, there is a race condition window between the time we resolve the
file to addremove with the matcher and the time we lock the repo and modify the
dirstate.
For example, the working copy might have been updated away, or purged, and the
matched files would no longer be correct.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 16:26:13 +0100] rev 50006
locking: take the `wlock` for the full `hg forget` duration
Otherwise, there is a race condition window between the time we resolve the
file to forget with the matcher and the time we lock the repo and modify the
dirstate.
For example, the working copy might have been updated away, or purged, and the
matched files would no longer be correct.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 04:22:46 +0100] rev 50005
locking: take the `wlock` for the full `hg remove` duration
Otherwise, there is a race condition window between the time we resolve the
file to remove with the matcher and the time we lock the repo and modify the
dirstate.
For example, the working copy might have been updated away, or purged, and the
matched files would no longer be correct.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 13 Dec 2022 04:21:27 +0100] rev 50004
locking: take the `wlock` for the full `hg add` duration
Otherwise, there is a race condition window between the time we resolve the
file to add with the matcher and the time we lock the repo and modify the
dirstate.
For example, the working copy might have been updated away, or purged, and the
matched files would no longer be correct.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Feb 2023 01:22:01 +0100] rev 50003
dirstate: drop some very fishy looking piece of code
This piece of code is marking the **real** dirstate file as a temporary
transaction file. This means it get deleted on transaction rollback.
This this quite wrong, especially as the comment points out some
`dirstate.pending` motivation and the `.pending` file should already be fully
managed by the transaction.
The only ready I can think of this behavior not having awful results right now
is because other transaction logic restore backed up content above the one that
got wrongfully deleted.
Let us stop doing this anyway, All tests seems happy.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 14 Feb 2023 23:05:18 +0100] rev 50002
dirstate: do not write an empty dirstate just for backup
This will get in the way when we get more strict about holding the lock when
writing the dirstate.
Instead, we simply don't copy dirstate files around if there are None at backup
time.
A couple of tests are impacted they no longer need to backup such "empty"
dirstate.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 14 Feb 2023 22:46:26 +0100] rev 50001
dirstate: pre-indent some of the backup code
This will make the next changeset clearer.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 14 Feb 2023 22:27:24 +0100] rev 50000
debugrebuilddirstate: double check that no transaction is open
Since transaction impact dirstate write, we make sure nobody is trying anything
strange with this internal command.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 14 Feb 2023 22:26:23 +0100] rev 49999
dirstate: explicitly write the dirstate after `debugrebuilddirstate`
I am working on making the dirstate write patterns more predictable. This patch is
part of a small series of similar patches that adds a explicit dirstate write in
a handful of location where the dirstate is updated "a bit in a strange way".
With this explicit write, we are no longer relying on implicite write of the
dirstate on `wlock` release. This make the world a better place.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 13 Feb 2023 22:53:54 +0100] rev 49998
dirstate: explicitly write the dirstate after `keyword` "overwrite"
I am working on making the dirstate write patterns more predictable. This patch is
part of a small series of similar patches that adds a explicit dirstate write in
a handful of location where the dirstate is updated "a bit in a strange way".
With this explicit write, we are no longer relying on implicite write of the
dirstate on `wlock` release. This make the world a better place.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 13 Feb 2023 23:33:27 +0100] rev 49997
dirstate: explicitly write the dirstate after `eol` dirstate manipulation
I am working on making the dirstate write patterns more predictable. This patch is
part of a small series of similar patches that adds a explicit dirstate write in
a handful of location where the dirstate is updated "a bit in a strange way".
With this explicit write, we are no longer relying on implicite write of the
dirstate on `wlock` release. This make the world a better place.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 13 Feb 2023 23:49:52 +0100] rev 49996
dirstate: explicitly write the dirstate after mq dirstate rebuild
I am working on making the dirstate write patterns more predictable. This patch is
part of a small series of similar patches that adds a explicit dirstate write in
a handful of location where the dirstate is updated "a bit in a strange way".
With this explicit write, we are no longer relying on implicite write of the
dirstate on `wlock` release. This make the world a better place.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 14 Feb 2023 20:09:39 +0100] rev 49995
transaction: quietly rollback if no other changes than temporary files
If no actual change have been made, we don't really need to roll them back. We
only have to cleanup some temporary files and it seems reasonable to do that
quietly.
This will help us to use the transaction in wider context¹ without impacting the
user experience.
[1] as in Python context managers that lives longer.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 14 Feb 2023 20:04:17 +0100] rev 49994
transaction: run abort callback in all cases
Previously, these possibly important callback were "forgotten" when running a
quick rollback.
This is now fixed, as the tests shown.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 14 Feb 2023 18:59:04 +0100] rev 49993
transaction: clarify the "quick abort" scenario
Right now, the transaction has a code-pass to do a "quick abort" that skip most¹
(too much) of the logic when the right condition are detected²
We are about to improve this logic in multiple aspect. We clarify the code
first.
The conditional return in `_can_quick_abort` looks a bit weird because we are
about to make them more complex very soon.
[1] actually too much
[2] actually not often enough
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 07 Feb 2023 15:27:37 +0100] rev 49992
test: use a more direct form of interruption in fncache "recover" testing
The previous test was relying on implementation details and harder to maintain.
The new version is closer to the initial intend : "What happens if the process
die without cleanup".
This change is motivated by further changes around the transaction and dirstate
logic that would break the fragile equilibrium that existed before this patch.
Making this change early make it easier to review on its own and remove noise
in future larger changes.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 07 Feb 2023 13:14:59 +0100] rev 49991
test: use a more direct approach to test racy mutation
The previous test was relying on implementation details and harder to maintain.
The new version is closer to the initial intend : "What happens the file get overwritten from under the current process"
This change is motivated by further changes around the transaction and dirstate
logic that would break the fragile equilibrium that existed before this patch.
Making this change early make it easier to review on its own and remove noise
in future larger changes.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 13 Feb 2023 23:56:13 +0100] rev 49990
test: create some history in test-dirstate-backup
An empty repository, based on `null` is quite a corner cases. We create a more
"natural" setup for this tests to make sure it can keep testing what it intend
to test in the future.