# HG changeset patch # User Pierre-Yves David # Date 1495916720 -7200 # Node ID 63afbc74a856453dbdb1e288a0542505f5c14f62 # Parent 53f47cc085d8dd1f0c4429039cb18b7fa42f5d98 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 -r 53f47cc085d8 -r 63afbc74a856 tests/test-push-race.t --- a/tests/test-push-race.t Sat May 27 22:24:58 2017 +0200 +++ b/tests/test-push-race.t Sat May 27 22:25:20 2017 +0200 @@ -189,3 +189,92 @@ | @ 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) +