comparison tests/test-racy-mutations.t @ 50029:28dfb2df4ab9

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 15 Feb 2023 11:51:58 +0100
parents 3997c64eff8b
children dcaa2df1f688
comparison
equal deleted inserted replaced
50028:a46dfc2b58a3 50029:28dfb2df4ab9
104 2 1 ac80e6205bb2 222799e2f90b 000000000000 104 2 1 ac80e6205bb2 222799e2f90b 000000000000
105 #endif 105 #endif
106 106
107 #if fail-if-detected 107 #if fail-if-detected
108 $ cat .foo_commit_out 108 $ cat .foo_commit_out
109 note: commit message saved in .hg/last-message.txt
110 note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it
109 transaction abort! 111 transaction abort!
110 rollback completed 112 rollback completed
111 note: commit message saved in .hg/last-message.txt
112 note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it
113 abort: 00changelog.i: file cursor at position 249, expected 121 113 abort: 00changelog.i: file cursor at position 249, expected 121
114 And no corruption in the changelog. 114 And no corruption in the changelog.
115 $ hg debugrevlogindex -c 115 $ hg debugrevlogindex -c
116 rev linkrev nodeid p1 p2 116 rev linkrev nodeid p1 p2
117 0 0 222799e2f90b 000000000000 000000000000 117 0 0 222799e2f90b 000000000000 000000000000