changeset 50322:08f3875020d1 stable

dirstate: add a test to highlight another changelog / dirstate race
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Thu, 23 Mar 2023 11:24:47 +0000
parents 14b57943ae6d
children 6901916458bd
files tests/test-hook.t
diffstat 1 files changed, 39 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-hook.t	Thu Mar 23 19:10:15 2023 +0100
+++ b/tests/test-hook.t	Thu Mar 23 11:24:47 2023 +0000
@@ -1430,3 +1430,42 @@
   ### no ######## plain: <unset>
   ### auto ###### plain: 1
   Mercurial Distributed SCM (*) (glob)
+
+Test hook that change the underlying repo
+=========================================
+
+blackbox access the dirstate afterward and can see a changelog / dirstate
+desync.
+
+
+  $ cd $TESTTMP
+  $ cat <<EOF >> $HGRCPATH
+  > [extensions]
+  > blackbox=
+  > [hooks]
+  > post-merge = hg commit -m "auto merge"
+  > EOF
+
+  $ hg init t
+  $ cd t
+  $ touch ".hgignore"
+  $ hg commit -Am "initial" -d'0 0'
+  adding .hgignore
+
+  $ echo This is file a1 > a
+  $ hg commit -Am "commit #1" -d'0 0'
+  adding a
+
+  $ hg update 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo This is file b1 > b
+  $ hg commit -Am "commit #2" -d'0 0'
+  adding b
+  created new head
+
+  $ hg merge 1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  warning: ignoring unknown working parent 449f60fb3fe2! (known-bad-output !)
+
+  $ cd ..