Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 15:28:08 +0100] rev 50193
dirstate: add documentation about the expectation of `running_status` context
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 14:55:16 +0100] rev 50192
contrib-perf: use `running_status` in `perf::status`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 17:16:52 +0100] rev 50191
large-files: also open the context in the subdirstate
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Feb 2023 00:23:06 +0100] rev 50190
large-files: use `running_status` in `mergeupdate`
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Feb 2023 00:22:44 +0100] rev 50189
large-files: use `running_status` in `scmutiladdremove`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Feb 2023 00:24:47 +0100] rev 50188
large-files: open the transaction sooner in `scmutiladdremove`
We want it to encompass the status call.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Feb 2023 00:22:16 +0100] rev 50187
large-files: use `running_status` in `overriderevert`
This is the way
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Feb 2023 00:21:57 +0100] rev 50186
large-files: use `running_status` in `updatestandinsbymatch`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Feb 2023 00:19:00 +0100] rev 50185
large-files: wrap reposetup's status in a `running_status` context
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Feb 2023 00:41:27 +0100] rev 50184
narrow: use `running_status` in `updateworkingcopy`
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 17:26:41 +0100] rev 50183
status: use `running_status` in dirstate status
This is the way.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 17:22:57 +0100] rev 50182
status: pre-indent the dirstate status code
This make the next changeset clearer.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 15:18:07 +0100] rev 50181
dirstate: introduce a (noop) running_status context
Let us start with a simplistic context so we can scope the appropriate code
before adding more logic.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Feb 2023 22:14:12 +0100] rev 50180
status: invalidate dirstate on LockError
If we cannot take the lock, someone else is modifying the repository. Let us
discard dirstate uncommitted data before exiting the status code.
Having a clean dirstate after such operation seems safer.
Strictly speaking, there is a small behavior change in the following situation:
* process A call `status` outside of the `wlock`
* process B grab the `wlock`
* process A fails to acquires the lock to write status fixup
* process B release the `wlock` *without touching the dirstate*
* process A later grab the `wlock`
* process A can write dirstate update from earlier `status`
However this is a fairly hypothetical situation :
* process A has to be raced
* process B have to not update the dirstate
* process A has to run another *unrelated* operation later.
This seems rare enough to overlook.
I am stating that the two operations in process A has to be unrelated.
Otherwise, collecting status data outside of the lock to use them inside the
lock is racy. Any other process could move things around (eg: the working copy)
making the data collected during status irrelevantor even harmful.
If such code exists, it should be fixed ASAP.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Feb 2023 16:20:11 +0100] rev 50179
status: simplify the post status fixup phases
With the wlock automatically discarding changes when applicable, we can
simplify the code a bit.
* we perform the fixup operation before trying to grab the lock to narrow the `try/except`
* we no longer need to explicitly complare dirstate identities. We can trust
the dirstate internal refresh for that. It would invalidate dirty data when
needed.
* detect still data invalidation by checking the dirty flag before and after
taking the lock. Doing this is actually only necessary to issue the debug
message, we could blindy trust the dirstate internal to ignore the `write`
call on a non-dirty dirstate.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Feb 2023 15:35:31 +0100] rev 50178
dirstate: cleanup the `_map` property cache
The removed code was duplicating the effect of `@propertycache`.
This is a gratuitous cleanup.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Feb 2023 01:08:25 +0100] rev 50177
dirstate: only reload the dirstate when it may have changed
This reinstall the equivalent of what the `filecache` was doing. However it does
it at the dirstate level.
There is a double motivation for this:
- This avoid duplicating logic with the dirstate "identity" logic.
- This increase the lifetime of the `dirstate` object, helping to implement
change scoping.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Feb 2023 01:04:55 +0100] rev 50176
dirstate: directly manage the dirstate property on localrepo
Before we had:
* the filecache layer on `localrepo` doing some caching
* the dirstate having some internal invalidation/refresh machanism
* the status code doing some identity validation.
To clean this up, we are dropping the first item "localrepo `filecache`" from
the equation in a favor of an approach integrated into the dirstate (second
item) in the next changesets.
This changeset will be a small windows where some things will be a bit slower.
This will be fixed in the next changesets.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Feb 2023 15:10:12 +0100] rev 50175
dirstate: factor the identity getting/setting code in the dirstate map
We are doing the same things twice and we will add more logic in the next
changesets. So lets start factoring things out now.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Feb 2023 00:53:51 +0100] rev 50174
dirstate: use `cachestat` object for dirstatemap identity
There is a class dedicated to this kind of cache check, let us use it.
We will generalize this code in the next changesets, but we do the "behavior
changing" pass on our own.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Feb 2023 22:17:33 +0100] rev 50173
automv: lock the repository before searching for renames
I detected this while debugging something else.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 23:46:20 +0100] rev 50172
dirstate: distinct transaction callback from largefile
This has not caused any issue so far because the large-files dirstate bypass the
transaction logic. We might want to change that.
In anyway, let us disarm this bug nest before it actually explode.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 16:31:36 +0100] rev 50171
dirstate: track that changes are pending in a transaction
Nothing is currently broken because if this, but this make the
`_invalidated_context` attribute more accurate.
Being more accurate here will help us later, when dealing with `status` call.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Feb 2023 17:43:43 +0100] rev 50170
dirstate: add small asserts for double security
We don't need this, but it does not hurt.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 15:58:17 +0100] rev 50169
dirstate: simplify the invalidation management on context exit
Since the `invalidate` call will directly reset the `_invalidated_context` attribut, we can simplify the code.
In the same go, we move most of the logic out of the `finally` clause. It seems
cleaner and safer. If we are handling an exception, we don't need the `write`
code anyway.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 15:52:55 +0100] rev 50168
dirstate: use the new `check_invalidated` decorator for `_changing`
WeeeEEeee, less code.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Feb 2023 22:25:20 +0100] rev 50167
dirstate: introduce a check_invalidated decorator
This is a common need, so let us consolidate it to simplify the code.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 19 Feb 2023 03:21:12 +0100] rev 50166
dirstate: warn if dirty when starting an edition
The dirstate should be clean before we start changing it. Otherwise we might
write unrelated changes. Having a dirty dirstate laying around is also
suspicious.
This is similar to what we do when opening a new transaction, but this time
this affect dirstate changes outside of a transaction.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Feb 2023 03:22:51 +0100] rev 50165
large-files: make sure we write newly initialized standin file early
Any changing context will have to initialized it before anything else. Not
flushing the default (pre-change) content mean we would enter the changing
context with a dirty dirstate, which is odd.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 14:06:15 +0100] rev 50164
dirstate: mark `clear` and `rebuild` as `require_changing_parents`
Yeah, more scoping!