changeset 50314:6487737e0f00 stable

revlog: test that pending hooks properly see the repository on split This seems important to explicitly cover this case before changing the code.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 20 Mar 2023 11:09:03 +0100
parents b0cdd0bea103
children cf6e1d535602
files tests/test-transaction-rollback-on-revlog-split.t
diffstat 1 files changed, 39 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 ..