shelve: do not add the dirstate backup to the transaction stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 04 Oct 2022 14:33:31 +0200
branchstable
changeset 49507 f0a3aaa07d6a
parent 49505 b6c6ac6ef359
child 49518 805419729e11
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.
mercurial/shelve.py
tests/test-shelve.t
tests/test-shelve2.t
--- 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)
 
--- 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 <<EOF >> $HGRCPATH
   > [extensions]
--- 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 <<EOF >> $HGRCPATH
   > [extensions]