[PATCH 2 of 9] test: add a push race case where each client replaces a different head

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun May 28 19:11:24 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1495916720 -7200
#      Sat May 27 22:25:20 2017 +0200
# Node ID e2339b057b7e267204b3c92e88e6cc4be0258581
# Parent  91964bf217343464079f0d62fda986ba865a4fe5
# EXP-Topic pushrace
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r e2339b057b7e
test: add a push race case where each client replaces a different head

We check case where the raced push replace one head while the racing push
replaces another unrelated one.

That second test also make sure we synchronise all repositories to the same
state between tests. That will help us when allowing some sort of concurrent
pushes.

diff --git a/tests/test-push-race.t b/tests/test-push-race.t
--- a/tests/test-push-race.t
+++ b/tests/test-push-race.t
@@ -189,3 +189,92 @@ Check the result of the push
   |
   @  842e2fac6304 C-ROOT (default)
   
+
+Pushing on two different heads
+------------------------------
+
+Both try to replace a different head
+
+#  a b
+#  | |
+#  * *
+#  |/
+#  *
+
+(resync-all)
+
+  $ hg -R ./server pull ./client-racy
+  pulling from ./client-racy
+  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 ./client-other 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 ./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  a9149a1428e2 C-B (default)
+  |
+  | o  98217d5a1659 C-A (default)
+  |/
+  @  842e2fac6304 C-ROOT (default)
+  
+
+Creating changesets
+
+  $ echo aa >> client-other/a
+  $ hg -R client-other/ commit -m "C-C"
+  $ echo bb >> client-racy/b
+  $ hg -R client-racy/ commit -m "C-D"
+
+Pushing
+
+  $ hg -R client-racy push -r 'tip' > ./push-log 2>&1 &
+
+  $ waiton $TESTTMP/readyfile
+
+  $ hg -R client-other push -r 'tip'
+  pushing to ssh://user@dummy/server
+  searching for changes
+  remote: adding changesets
+  remote: adding manifests
+  remote: adding file changes
+  remote: added 1 changesets with 1 changes to 1 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 graph
+  o  51c544a58128 C-C (default)
+  |
+  o  98217d5a1659 C-A (default)
+  |
+  | o  a9149a1428e2 C-B (default)
+  |/
+  @  842e2fac6304 C-ROOT (default)
+  


More information about the Mercurial-devel mailing list