test: add a push race case where obsoleted head is updated
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 29 May 2017 05:53:24 +0200
changeset 32669 6ac367b6ae8a
parent 32668 d7626e85dada
child 32670 41b8cfe85383
test: add a push race case where obsoleted head is updated We check the case where the raced-push obsoletes a head while the racing-push updates that same head.
tests/test-push-race.t
--- a/tests/test-push-race.t	Fri Jun 02 14:08:26 2017 -0700
+++ b/tests/test-push-race.t	Mon May 29 05:53:24 2017 +0200
@@ -94,6 +94,10 @@
   > ssh = python "$TESTDIR/dummyssh"
   > # simplify output
   > logtemplate = {node|short} {desc} ({branch})
+  > [phases]
+  > publish = no
+  > [experimental]
+  > evolution = all
   > [alias]
   > graph = log -G --rev 'sort(all(), "topo")'
   > EOF
@@ -1246,3 +1250,182 @@
   |/
   o  842e2fac6304 C-ROOT (default)
   
+
+raced commit push a new head obsoleting the one touched by the racing push
+--------------------------------------------------------------------------
+
+#  b (racing)
+#  |
+#  ø⇠◔ a (raced)
+#  |/
+#  *
+
+(resync-all)
+
+  $ hg -R ./server pull ./client-racy
+  pulling from ./client-racy
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files (+1 heads)
+  (run 'hg heads .' to see heads, 'hg merge' to merge)
+  $ hg -R ./client-other pull
+  pulling from ssh://user@dummy/server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files (+1 heads)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+  $ hg -R ./client-racy pull
+  pulling from ssh://user@dummy/server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+
+  $ hg -R server graph
+  o  3d57ed3c1091 C-T (other)
+  |
+  o  2efd43f7b5ba C-S (default)
+  |
+  | o  de7b9e2ba3f6 C-R (other)
+  |/
+  o  1b58ee3f79e5 C-P (default)
+  |
+  o  d0a85b2252a9 C-O (other)
+  |
+  | o  b0ee3d6f51bc C-Q (default)
+  |/
+  o  55a6f1c01b48 C-Z (other)
+  |
+  o    866a66e18630 C-N (default)
+  |\
+  +---o  6fd3090135df C-M (default)
+  | |
+  | o  cac2cead0ff0 C-L (default)
+  | |
+  o |  be705100c623 C-K (default)
+  |\|
+  o |  d603e2c0cdd7 C-E (default)
+  | |
+  | o  59e76faf78bd C-D (default)
+  | |
+  | | o  89420bf00fae C-J (default)
+  | | |
+  | | | o  b35ed749f288 C-I (my-second-test-branch)
+  | | |/
+  | | o  75d69cba5402 C-G (default)
+  | | |
+  | | | o  833be552cfe6 C-H (my-first-test-branch)
+  | | |/
+  | | o  d9e379a8c432 C-F (default)
+  | | |
+  +---o  51c544a58128 C-C (default)
+  | |
+  | o  a9149a1428e2 C-B (default)
+  | |
+  o |  98217d5a1659 C-A (default)
+  |/
+  o  842e2fac6304 C-ROOT (default)
+  
+
+Creating changesets and markers
+
+(continue existing head)
+
+  $ hg -R client-other/ up 'desc("C-Q")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo aaa >> client-other/a
+  $ hg -R client-other/ commit -m "C-U"
+
+(new topo branch obsoleting that same head)
+
+  $ hg -R client-racy/ up 'desc("C-Z")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo bbb >> client-racy/a
+  $ hg -R client-racy/ branch --force default
+  marked working directory as branch default
+  $ hg -R client-racy/ commit -m "C-V"
+  created new head
+  $ ID_Q=`hg -R client-racy log -T '{node}\n' -r 'desc("C-Q")'`
+  $ ID_V=`hg -R client-racy log -T '{node}\n' -r 'desc("C-V")'`
+  $ hg -R client-racy debugobsolete $ID_Q $ID_V
+
+Pushing
+
+  $ hg -R client-racy push -r 'tip' > ./push-log 2>&1 &
+
+  $ waiton $TESTTMP/readyfile
+
+  $ hg -R client-other push -fr 'tip' --new-branch
+  pushing to ssh://user@dummy/server
+  searching for changes
+  remote: adding changesets
+  remote: adding manifests
+  remote: adding file changes
+  remote: added 1 changesets with 0 changes to 0 files
+
+  $ release $TESTTMP/watchfile
+
+Check the result of the push
+
+  $ cat ./push-log
+  pushing to ssh://user@dummy/server
+  searching for changes
+  wrote ready: $TESTTMP/readyfile
+  waiting on: $TESTTMP/watchfile
+  abort: push failed:
+  'repository changed while pushing - please try again'
+
+  $ hg -R server debugobsolete
+  $ hg -R server graph
+  o  a98a47d8b85b C-U (default)
+  |
+  o  b0ee3d6f51bc C-Q (default)
+  |
+  | o  3d57ed3c1091 C-T (other)
+  | |
+  | o  2efd43f7b5ba C-S (default)
+  | |
+  | | o  de7b9e2ba3f6 C-R (other)
+  | |/
+  | o  1b58ee3f79e5 C-P (default)
+  | |
+  | o  d0a85b2252a9 C-O (other)
+  |/
+  o  55a6f1c01b48 C-Z (other)
+  |
+  o    866a66e18630 C-N (default)
+  |\
+  +---o  6fd3090135df C-M (default)
+  | |
+  | o  cac2cead0ff0 C-L (default)
+  | |
+  o |  be705100c623 C-K (default)
+  |\|
+  o |  d603e2c0cdd7 C-E (default)
+  | |
+  | o  59e76faf78bd C-D (default)
+  | |
+  | | o  89420bf00fae C-J (default)
+  | | |
+  | | | o  b35ed749f288 C-I (my-second-test-branch)
+  | | |/
+  | | o  75d69cba5402 C-G (default)
+  | | |
+  | | | o  833be552cfe6 C-H (my-first-test-branch)
+  | | |/
+  | | o  d9e379a8c432 C-F (default)
+  | | |
+  +---o  51c544a58128 C-C (default)
+  | |
+  | o  a9149a1428e2 C-B (default)
+  | |
+  o |  98217d5a1659 C-A (default)
+  |/
+  o  842e2fac6304 C-ROOT (default)
+