Mercurial > hg
diff tests/test-push-race.t @ 32709:16ada4cbb1a9
push: add a way to allow concurrent pushes on unrelated heads
Client has a mechanism for the server to check that nothing changed server side
since the client prepared a push. That check is wide and any head changed on
the server will lead to an aborted push. We introduce a way for the client to
send a less strict checking. That logic will check that no heads impacted by
the push have been affected. If other unrelated heads (including named branches
heads) have been affected, the push will proceed.
This is very helpful for repositories with high developers traffic on different
heads, a common setup.
That behavior is currently controlled by an experimental option. The config
should live in the "server" section but bike-shedding of the name will happen
in the next changesets. Servers advertise this capability through a new bundle2
capability 'checkeads', using the value 'related'.
The 'test-push-race.t' is updated to check that new capabilities on the
documented cases.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 29 May 2017 05:53:58 +0200 |
parents | 41b8cfe85383 |
children | a7851519ea02 |
line wrap: on
line diff
--- a/tests/test-push-race.t Mon May 29 05:52:13 2017 +0200 +++ b/tests/test-push-race.t Mon May 29 05:53:58 2017 +0200 @@ -102,6 +102,21 @@ > graph = log -G --rev 'sort(all(), "topo")' > EOF +We tests multiple cases: +* strict: no race detected, +* unrelated: race on unrelated heads are allowed. + +#testcases strict unrelated + +#if unrelated + + $ cat >> $HGRCPATH << EOF + > [experimental] + > checkheads-strict = no + > EOF + +#endif + Setup ----- @@ -265,6 +280,7 @@ Check the result of the push +#if strict $ cat ./push-log pushing to ssh://user@dummy/server searching for changes @@ -282,6 +298,34 @@ |/ @ 842e2fac6304 C-ROOT (default) +#endif +#if unrelated + +(The two heads are unrelated, push should be allowed) + + $ cat ./push-log + pushing to ssh://user@dummy/server + searching for changes + wrote ready: $TESTTMP/readyfile + waiting on: $TESTTMP/watchfile + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + + $ hg -R server graph + o 59e76faf78bd C-D (default) + | + o a9149a1428e2 C-B (default) + | + | o 51c544a58128 C-C (default) + | | + | o 98217d5a1659 C-A (default) + |/ + @ 842e2fac6304 C-ROOT (default) + +#endif + Pushing while someone creates a new head ----------------------------------------- @@ -295,6 +339,8 @@ (resync-all) +#if strict + $ hg -R ./server pull ./client-racy pulling from ./client-racy searching for changes @@ -303,6 +349,17 @@ adding file changes added 1 changesets with 1 changes to 1 files (run 'hg update' to get a working copy) + +#endif +#if unrelated + + $ hg -R ./server pull ./client-racy + pulling from ./client-racy + searching for changes + no changes found + +#endif + $ hg -R ./client-other pull pulling from ssh://user@dummy/server searching for changes @@ -367,6 +424,8 @@ Check the result of the push +#if strict + $ cat ./push-log pushing to ssh://user@dummy/server searching for changes @@ -389,6 +448,39 @@ @ 842e2fac6304 C-ROOT (default) +#endif + +#if unrelated + +(The racing new head do not affect existing heads, push should go through) + + $ cat ./push-log + pushing to ssh://user@dummy/server + searching for changes + wrote ready: $TESTTMP/readyfile + waiting on: $TESTTMP/watchfile + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + + $ hg -R server graph + o d9e379a8c432 C-F (default) + | + o 51c544a58128 C-C (default) + | + | o d603e2c0cdd7 C-E (default) + |/ + o 98217d5a1659 C-A (default) + | + | o 59e76faf78bd C-D (default) + | | + | o a9149a1428e2 C-B (default) + |/ + @ 842e2fac6304 C-ROOT (default) + +#endif + Pushing touching different named branch (same topo): new branch raced --------------------------------------------------------------------- @@ -402,6 +494,8 @@ (resync-all) +#if strict + $ hg -R ./server pull ./client-racy pulling from ./client-racy searching for changes @@ -410,6 +504,17 @@ adding file changes added 1 changesets with 1 changes to 1 files (run 'hg update' to get a working copy) + +#endif +#if unrelated + + $ hg -R ./server pull ./client-racy + pulling from ./client-racy + searching for changes + no changes found + +#endif + $ hg -R ./client-other pull pulling from ssh://user@dummy/server searching for changes @@ -480,6 +585,7 @@ Check the result of the push +#if strict $ cat ./push-log pushing to ssh://user@dummy/server searching for changes @@ -505,6 +611,43 @@ |/ @ 842e2fac6304 C-ROOT (default) +#endif +#if unrelated + +(unrelated named branches are unrelated) + + $ cat ./push-log + pushing to ssh://user@dummy/server + searching for changes + wrote ready: $TESTTMP/readyfile + waiting on: $TESTTMP/watchfile + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files (+1 heads) + + $ hg -R server graph + o 833be552cfe6 C-H (my-first-test-branch) + | + | o 75d69cba5402 C-G (default) + |/ + o d9e379a8c432 C-F (default) + | + o 51c544a58128 C-C (default) + | + | o d603e2c0cdd7 C-E (default) + |/ + o 98217d5a1659 C-A (default) + | + | o 59e76faf78bd C-D (default) + | | + | o a9149a1428e2 C-B (default) + |/ + @ 842e2fac6304 C-ROOT (default) + +#endif + +The racing new head do not affect existing heads, push should go through pushing touching different named branch (same topo): old branch raced --------------------------------------------------------------------- @@ -519,6 +662,8 @@ (resync-all) +#if strict + $ hg -R ./server pull ./client-racy pulling from ./client-racy searching for changes @@ -527,6 +672,17 @@ adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) (run 'hg heads .' to see heads, 'hg merge' to merge) + +#endif +#if unrelated + + $ hg -R ./server pull ./client-racy + pulling from ./client-racy + searching for changes + no changes found + +#endif + $ hg -R ./client-other pull pulling from ssh://user@dummy/server searching for changes @@ -600,6 +756,8 @@ Check the result of the push +#if strict + $ cat ./push-log pushing to ssh://user@dummy/server searching for changes @@ -630,6 +788,48 @@ @ 842e2fac6304 C-ROOT (default) +#endif + +#if unrelated + +(unrelated named branches are unrelated) + + $ cat ./push-log + pushing to ssh://user@dummy/server + searching for changes + wrote ready: $TESTTMP/readyfile + waiting on: $TESTTMP/watchfile + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files (+1 heads) + + $ hg -R server graph + 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 d603e2c0cdd7 C-E (default) + |/ + o 98217d5a1659 C-A (default) + | + | o 59e76faf78bd C-D (default) + | | + | o a9149a1428e2 C-B (default) + |/ + @ 842e2fac6304 C-ROOT (default) + + +#endif + pushing racing push touch multiple heads ---------------------------------------- @@ -644,6 +844,8 @@ (resync-all) +#if strict + $ hg -R ./server pull ./client-racy pulling from ./client-racy searching for changes @@ -652,6 +854,18 @@ adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) (run 'hg heads .' to see heads, 'hg merge' to merge) + +#endif + +#if unrelated + + $ hg -R ./server pull ./client-racy + pulling from ./client-racy + searching for changes + no changes found + +#endif + $ hg -R ./client-other pull pulling from ssh://user@dummy/server searching for changes