# HG changeset patch # User Pierre-Yves David # Date 1664886811 -7200 # Node ID f0a3aaa07d6a38f398b95de3eddcc9eaf24f8ffe # Parent b6c6ac6ef3599ee017786b6fc3854c172dfa863a shelve: do not add the dirstate backup to the transaction Otherwise the transaction will properly clean up its mess on abort… deleting the backup in the process. This break with dirstate-v2 that has more file than just the dirstate. The dirstate itself is full of various exception and is "fine" when using dirstate-v1. diff -r b6c6ac6ef359 -r f0a3aaa07d6a mercurial/shelve.py --- a/mercurial/shelve.py Tue Oct 04 10:24:56 2022 +0200 +++ b/mercurial/shelve.py Tue Oct 04 14:33:31 2022 +0200 @@ -378,7 +378,7 @@ def _aborttransaction(repo, tr): """Abort current transaction for shelve/unshelve, but keep dirstate""" dirstatebackupname = b'dirstate.shelve' - repo.dirstate.savebackup(tr, dirstatebackupname) + repo.dirstate.savebackup(None, dirstatebackupname) tr.abort() repo.dirstate.restorebackup(None, dirstatebackupname) diff -r b6c6ac6ef359 -r f0a3aaa07d6a tests/test-shelve.t --- a/tests/test-shelve.t Tue Oct 04 10:24:56 2022 +0200 +++ b/tests/test-shelve.t Tue Oct 04 14:33:31 2022 +0200 @@ -1,4 +1,14 @@ #testcases stripbased phasebased +#testcases dirstate-v1 dirstate-v2 + +#if dirstate-v2 + $ cat >> $HGRCPATH << EOF + > [format] + > use-dirstate-v2=1 + > [storage] + > dirstate-v2.slow-path=allow + > EOF +#endif $ cat <> $HGRCPATH > [extensions] diff -r b6c6ac6ef359 -r f0a3aaa07d6a tests/test-shelve2.t --- a/tests/test-shelve2.t Tue Oct 04 10:24:56 2022 +0200 +++ b/tests/test-shelve2.t Tue Oct 04 14:33:31 2022 +0200 @@ -1,6 +1,16 @@ #testcases stripbased phasebased #testcases abortflag abortcommand #testcases continueflag continuecommand +#testcases dirstate-v1 dirstate-v2 + +#if dirstate-v2 + $ cat >> $HGRCPATH << EOF + > [format] + > use-dirstate-v2=1 + > [storage] + > dirstate-v2.slow-path=allow + > EOF +#endif $ cat <> $HGRCPATH > [extensions]