dirstate: add a test to highlight another changelog / dirstate race stable
authorArseniy Alekseyev <aalekseyev@janestreet.com>
Thu, 23 Mar 2023 11:24:47 +0000
branchstable
changeset 50353 08f3875020d1
parent 50352 14b57943ae6d
child 50354 6901916458bd
dirstate: add a test to highlight another changelog / dirstate race
tests/test-hook.t
--- 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 ..