changeset 49466:486b8a383100 stable

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 31 Aug 2022 05:48:32 +0200
parents 6b4ad07b4d69
children 0705afae6253
files tests/test-dirstate.t
diffstat 1 files changed, 38 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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