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!
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 11:37:02 +0100] rev 50163
dirstate: add a comment about the semantic of `dirstate.clear`
This method is weird, lets flag it as such.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 14:05:19 +0100] rev 50162
debugrebuildstate: wrap the operation in a `changing_parents` context
This ismaybe a "changing_files" case? However this would be the only
usage of `rebuild` outside a `changing_parents` context and this is a debug
command, so lets not make the code base more complex because of that one command.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 19 Feb 2023 02:50:46 +0100] rev 50161
strip: use a `changing_parents` context for --keep update
These are now properly scoped.
note: it would be neat to reuse this in `hg rollback`.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 19 Feb 2023 02:47:28 +0100] rev 50160
mq: wrap the dirstate's rebuild in a `changing_parents` context
This code is dealing with `qreshesh` failure. In that case the working copy
will be left on the parent of the refreshed patch, so the parents are changing
and `changing_parents` make sens.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 11:37:05 +0100] rev 50159
lfconvert: use a `changing_parents` context to clear the dirstate
Not sure if this is the right context, but it works and it is consistent with
the other usages of `dirstate.clear`.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 11:57:46 +0100] rev 50158
dirstate: mark the `copy` method as requiring a `changing_any` context
This is used both when changing parents (e.g. merging with rename) and changing
files (e.g. running `hg rename`).
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 11:54:10 +0100] rev 50157
dirstate: add a `require_changing_any` decorator
We will need it for a couple of usecase (e.g `dirstate.copy`).
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Feb 2023 12:06:03 +0100] rev 50156
rebase: scope parent change into a changing_parents context
If we are actually altering the working copy (i.e. we are not in memory), we
should properly scope the working copy update.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 18 Feb 2023 04:10:08 +0100] rev 50155
dirstate: requires being in a `changing_parents` `context to set_parents`
Enforcing proper operation scoping on all methods that mutate the dirstate will
tighten correctness and reduce the risk of bugs.
The context to use for this method is obvious, and all code was already
compliant ☺
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Feb 2023 00:10:20 +0100] rev 50154
dirstate: invalidate on all exceptions
Previously, we would miss SystemExit, KeyboardInterrupt etc.
This "fix" on the bug tested in "test-largefiles-update.t" by preventing the
precisely tested situation to happens at all. However this reveal a similar bug
with a different timing.
I have not been able to deal with that pre-existing bug so far. So I updated the
test to point that out.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Feb 2023 01:09:11 +0100] rev 50153
large-files: prepare a test for more changes
The behavior around this test is about to change. We update the test to make it
more robust and the changes clearer.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Feb 2023 00:32:40 +0100] rev 50152
large-files: larger "changing_parents" context in mergeupdate override
This since we are updating the lfdirstate early, it seems reasonable to include
the full function in that scope.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 19 Feb 2023 03:14:44 +0100] rev 50151
large-files: use `hacky_extension_update_file` one more time
This override is about merging and can be used in a `changing_parents` context.
So lets use the method dedicated to hacky stuff when doing hacky stuff.
Matt Harbison <matt_harbison@yahoo.com> [Sun, 19 Feb 2023 00:04:53 -0500] rev 50150
typing: disable `signature-mismatch` warnings on a few bytestr functions
Recent versions of pytype complain about this, but it seems like expected
behavior.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 18 Feb 2023 02:39:32 +0100] rev 50149
branching: merge with stable
Arseniy Alekseyev <aalekseyev@janestreet.com> [Thu, 16 Feb 2023 14:56:59 +0000] rev 50148
rhg: fix a bug in path_encode
This makes rhg able to access long paths at the root of the tree just fine.
Arseniy Alekseyev <aalekseyev@janestreet.com> [Thu, 16 Feb 2023 14:54:34 +0000] rev 50147
rhg: demonstrate a bug in path_encode
The bug means that long filenames at the root of the tree are encoded
incorrectly by rhg, so rhg crashes when trying to access them.
Arseniy Alekseyev <aalekseyev@janestreet.com> [Thu, 16 Feb 2023 14:43:46 +0000] rev 50146
rhg: nicer error message
Matt Harbison <matt_harbison@yahoo.com> [Tue, 14 Feb 2023 12:40:59 -0500] rev 50145
typing: add type hints to argument checking functions in cmdutil
These might be surprising, since they can take strings instead of bytes. The
way `AnyStr` works is that it must be all bytes or all str for any given
invocation.
The wildcard here will be the `opts` that get passed in- if the type is unknown
and defaults to `Any`, there's no enforcement that the dict key type matches the
additional args. But a lot of uses should be using `**opts` from the command
method, which has a str key. The uses of these methods in this module are now
typed because their internals force a specific type, and it can't just be
inferred from the caller.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 14 Feb 2023 15:45:26 -0500] rev 50144
tag: move the prohibition of tagging the `null` rev up to the `wdir()` check
It makes sense to do these together, and avoid another revision lookup.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 17 Feb 2023 17:04:41 +0100] rev 50143
branching: merge with default
the first part of the fix is there
Dan Villiom Podlaski Christiansen <dan.villiom.podlaski.christiansen@sallinggroup.com> [Fri, 27 Jan 2023 17:30:51 +0100] rev 50142
tests: remove unnecessary --traceback argument
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 04:49:35 +0100] rev 50141
dirstate: remove the dedicated backup logic
When alone, the dirstate can now take care of its commit/rollback pattern
itself.
When in a transaction, the transaction deal with commit/rollback pattern quite
fine.
Why did you have a dedicated backup logic?
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 04:02:36 +0100] rev 50140
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 50139
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.