Matt Harbison <matt_harbison@yahoo.com> [Tue, 14 Feb 2023 12:40:59 -0500] rev 50093
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.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 17 Feb 2023 16:45:36 +0100] rev 50092
setup: further improve the error path for version retrieval
This is a new take at the problem that
8d390a13474d tried to tackle. There was
two issues after that previous improvement:
- the 0.0+ version could survive a bit too long and reaching the installer
version and staying there.
- multiple use case where still failing.
So the new code is better at:
- always succeeding when running `make local` so that we can
bootstrap a local version
- no using that fallback outside of `make local` to avoid distribution of
version with the buggy version number.
The setup.py is a gigantic pile of spaghetti code, to the point where
pastafarian pilgrim started knocking at its core.
However I refrained from cleaning that up since the more to a `setup.cfg` means
this code should be deleted soon™.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 14 Feb 2023 15:45:26 -0500] rev 50091
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 50090
branching: merge with default
the first part of the fix is there
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 17 Feb 2023 14:00:39 +0100] rev 50089
dirstate: handle missing backup file on restoration
This is the stable counter part to
e358f6e0e50e.
Since 6.4 will stop writing undo.dirstate in some case (actually… at all), a
transaction created with 6.4 and recover/rolledback with 6.3 need to work to a
certain degreee. This changeset add the necessary bits so that we don't get a
traceback from 6..3 in this cases.
Dan Villiom Podlaski Christiansen <dan.villiom.podlaski.christiansen@sallinggroup.com> [Fri, 27 Jan 2023 17:30:51 +0100] rev 50088
tests: remove unnecessary --traceback argument
Matt Harbison <matt_harbison@yahoo.com> [Tue, 14 Feb 2023 11:56:02 -0500] rev 50087
tag: disallow tagging the working directory
It's kinda silly, but a clear error message is better than a stacktrace about
subscripting `None` when trying to generate the default commit message. I'm
surprised that `.revsingle(..).node()` returns None instead of `nodemod.wdirid`,
but now there's a test to catch if this changes.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Feb 2023 04:49:35 +0100] rev 50086
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 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.