revlog: test that pending hooks properly see the repository on split stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 20 Mar 2023 11:09:03 +0100
branchstable
changeset 50344 6487737e0f00
parent 50343 b0cdd0bea103
child 50345 cf6e1d535602
revlog: test that pending hooks properly see the repository on split This seems important to explicitly cover this case before changing the code.
tests/test-transaction-rollback-on-revlog-split.t
--- a/tests/test-transaction-rollback-on-revlog-split.t	Fri Mar 17 02:46:51 2023 +0100
+++ b/tests/test-transaction-rollback-on-revlog-split.t	Mon Mar 20 11:09:03 2023 +0100
@@ -392,3 +392,42 @@
   $ cat $TESTTMP/reader.stdout
                      1 (no-eol)
   $ cd ..
+
+pending hooks
+=============
+
+We checks that hooks properly see the inside of the transaction, while other process don't.
+
+  $ hg clone --quiet --rev 1 troffset-computation troffset-computation-hooks
+  $ cd troffset-computation-hooks
+  $ cat > .hg/hgrc <<EOF
+  > [hooks]
+  > pretxnclose.01-echo = hg cat -r 'max(all())' file | f --size
+  > pretxnclose.02-echo = $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/hook-done $TESTTMP/hook-tr-ready
+  > pretxnclose.03-abort = false
+  > EOF
+
+  $ (
+  >   $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/hook-tr-ready;\
+  >   hg cat -r 'max(all())' file | f --size;\
+  >   touch $TESTTMP/hook-done
+  > ) >stdout 2>stderr &
+
+  $ hg pull ../troffset-computation
+  pulling from ../troffset-computation
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  size=131072
+  transaction abort!
+  rollback completed
+  abort: pretxnclose.03-abort hook exited with status 1
+  [40]
+
+  $ cat stdout
+  size=1024
+  $ cat stderr
+
+
+  $ cd ..