dirstate-v2: display a possible issue with transaction stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 31 Aug 2022 05:48:32 +0200
branchstable
changeset 49466 486b8a383100
parent 49465 6b4ad07b4d69
child 49467 0705afae6253
dirstate-v2: display a possible issue with transaction If we backup the dirstate without the data file, we can end up in an inconsistent state of the transaction is rolled back.
tests/test-dirstate.t
--- a/tests/test-dirstate.t	Wed Aug 31 05:36:53 2022 +0200
+++ b/tests/test-dirstate.t	Wed Aug 31 05:48:32 2022 +0200
@@ -213,3 +213,41 @@
 
 #endif
 
+Transaction compatibility
+-------------------------
+
+The transaction preserves the dirstate.
+We should make sure all of it (docket + data) is preserved
+
+#if dirstate-v2
+  $ hg commit -m 'bli'
+#endif
+
+  $ hg update --quiet
+  $ hg revert --all --quiet
+  $ rm -f a
+  $ echo foo > foo
+  $ hg add foo
+  $ hg commit -m foo
+
+#if dirstate-v2
+  $ uid=$(find_dirstate_uuid)
+  $ touch bar
+  $ while [ uid = $(find_dirstate_uuid) ]; do
+  >    hg add bar;
+  >    hg remove bar;
+  > done;
+  $ rm bar
+#endif
+  $ hg rollback
+  repository tip rolled back to revision 1 (undo commit)
+  working directory now based on revision 1
+
+#if dirstate-v1
+  $ hg status
+  A foo
+#else
+  $ hg status
+  abort: $ENOENT$: '*/.hg/dirstate.*' (glob) (known-bad-output !)
+  [255]
+#endif