comparison 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
comparison
equal deleted inserted replaced
32708:90cb4ec8df64 32709:16ada4cbb1a9
100 > evolution = all 100 > evolution = all
101 > [alias] 101 > [alias]
102 > graph = log -G --rev 'sort(all(), "topo")' 102 > graph = log -G --rev 'sort(all(), "topo")'
103 > EOF 103 > EOF
104 104
105 We tests multiple cases:
106 * strict: no race detected,
107 * unrelated: race on unrelated heads are allowed.
108
109 #testcases strict unrelated
110
111 #if unrelated
112
113 $ cat >> $HGRCPATH << EOF
114 > [experimental]
115 > checkheads-strict = no
116 > EOF
117
118 #endif
119
105 Setup 120 Setup
106 ----- 121 -----
107 122
108 create a repo with one root 123 create a repo with one root
109 124
263 278
264 $ release $TESTTMP/watchfile 279 $ release $TESTTMP/watchfile
265 280
266 Check the result of the push 281 Check the result of the push
267 282
283 #if strict
268 $ cat ./push-log 284 $ cat ./push-log
269 pushing to ssh://user@dummy/server 285 pushing to ssh://user@dummy/server
270 searching for changes 286 searching for changes
271 wrote ready: $TESTTMP/readyfile 287 wrote ready: $TESTTMP/readyfile
272 waiting on: $TESTTMP/watchfile 288 waiting on: $TESTTMP/watchfile
280 | 296 |
281 | o a9149a1428e2 C-B (default) 297 | o a9149a1428e2 C-B (default)
282 |/ 298 |/
283 @ 842e2fac6304 C-ROOT (default) 299 @ 842e2fac6304 C-ROOT (default)
284 300
301 #endif
302 #if unrelated
303
304 (The two heads are unrelated, push should be allowed)
305
306 $ cat ./push-log
307 pushing to ssh://user@dummy/server
308 searching for changes
309 wrote ready: $TESTTMP/readyfile
310 waiting on: $TESTTMP/watchfile
311 remote: adding changesets
312 remote: adding manifests
313 remote: adding file changes
314 remote: added 1 changesets with 1 changes to 1 files
315
316 $ hg -R server graph
317 o 59e76faf78bd C-D (default)
318 |
319 o a9149a1428e2 C-B (default)
320 |
321 | o 51c544a58128 C-C (default)
322 | |
323 | o 98217d5a1659 C-A (default)
324 |/
325 @ 842e2fac6304 C-ROOT (default)
326
327 #endif
328
285 Pushing while someone creates a new head 329 Pushing while someone creates a new head
286 ----------------------------------------- 330 -----------------------------------------
287 331
288 Pushing a new changeset while someone creates a new branch. 332 Pushing a new changeset while someone creates a new branch.
289 333
293 # |/ 337 # |/
294 # * 338 # *
295 339
296 (resync-all) 340 (resync-all)
297 341
342 #if strict
343
298 $ hg -R ./server pull ./client-racy 344 $ hg -R ./server pull ./client-racy
299 pulling from ./client-racy 345 pulling from ./client-racy
300 searching for changes 346 searching for changes
301 adding changesets 347 adding changesets
302 adding manifests 348 adding manifests
303 adding file changes 349 adding file changes
304 added 1 changesets with 1 changes to 1 files 350 added 1 changesets with 1 changes to 1 files
305 (run 'hg update' to get a working copy) 351 (run 'hg update' to get a working copy)
352
353 #endif
354 #if unrelated
355
356 $ hg -R ./server pull ./client-racy
357 pulling from ./client-racy
358 searching for changes
359 no changes found
360
361 #endif
362
306 $ hg -R ./client-other pull 363 $ hg -R ./client-other pull
307 pulling from ssh://user@dummy/server 364 pulling from ssh://user@dummy/server
308 searching for changes 365 searching for changes
309 adding changesets 366 adding changesets
310 adding manifests 367 adding manifests
365 422
366 $ release $TESTTMP/watchfile 423 $ release $TESTTMP/watchfile
367 424
368 Check the result of the push 425 Check the result of the push
369 426
427 #if strict
428
370 $ cat ./push-log 429 $ cat ./push-log
371 pushing to ssh://user@dummy/server 430 pushing to ssh://user@dummy/server
372 searching for changes 431 searching for changes
373 wrote ready: $TESTTMP/readyfile 432 wrote ready: $TESTTMP/readyfile
374 waiting on: $TESTTMP/watchfile 433 waiting on: $TESTTMP/watchfile
386 | | 445 | |
387 | o a9149a1428e2 C-B (default) 446 | o a9149a1428e2 C-B (default)
388 |/ 447 |/
389 @ 842e2fac6304 C-ROOT (default) 448 @ 842e2fac6304 C-ROOT (default)
390 449
450
451 #endif
452
453 #if unrelated
454
455 (The racing new head do not affect existing heads, push should go through)
456
457 $ cat ./push-log
458 pushing to ssh://user@dummy/server
459 searching for changes
460 wrote ready: $TESTTMP/readyfile
461 waiting on: $TESTTMP/watchfile
462 remote: adding changesets
463 remote: adding manifests
464 remote: adding file changes
465 remote: added 1 changesets with 1 changes to 1 files
466
467 $ hg -R server graph
468 o d9e379a8c432 C-F (default)
469 |
470 o 51c544a58128 C-C (default)
471 |
472 | o d603e2c0cdd7 C-E (default)
473 |/
474 o 98217d5a1659 C-A (default)
475 |
476 | o 59e76faf78bd C-D (default)
477 | |
478 | o a9149a1428e2 C-B (default)
479 |/
480 @ 842e2fac6304 C-ROOT (default)
481
482 #endif
391 483
392 Pushing touching different named branch (same topo): new branch raced 484 Pushing touching different named branch (same topo): new branch raced
393 --------------------------------------------------------------------- 485 ---------------------------------------------------------------------
394 486
395 Pushing two children on the same head, one is a different named branch 487 Pushing two children on the same head, one is a different named branch
400 # |/ 492 # |/
401 # * 493 # *
402 494
403 (resync-all) 495 (resync-all)
404 496
497 #if strict
498
405 $ hg -R ./server pull ./client-racy 499 $ hg -R ./server pull ./client-racy
406 pulling from ./client-racy 500 pulling from ./client-racy
407 searching for changes 501 searching for changes
408 adding changesets 502 adding changesets
409 adding manifests 503 adding manifests
410 adding file changes 504 adding file changes
411 added 1 changesets with 1 changes to 1 files 505 added 1 changesets with 1 changes to 1 files
412 (run 'hg update' to get a working copy) 506 (run 'hg update' to get a working copy)
507
508 #endif
509 #if unrelated
510
511 $ hg -R ./server pull ./client-racy
512 pulling from ./client-racy
513 searching for changes
514 no changes found
515
516 #endif
517
413 $ hg -R ./client-other pull 518 $ hg -R ./client-other pull
414 pulling from ssh://user@dummy/server 519 pulling from ssh://user@dummy/server
415 searching for changes 520 searching for changes
416 adding changesets 521 adding changesets
417 adding manifests 522 adding manifests
478 583
479 $ release $TESTTMP/watchfile 584 $ release $TESTTMP/watchfile
480 585
481 Check the result of the push 586 Check the result of the push
482 587
588 #if strict
483 $ cat ./push-log 589 $ cat ./push-log
484 pushing to ssh://user@dummy/server 590 pushing to ssh://user@dummy/server
485 searching for changes 591 searching for changes
486 wrote ready: $TESTTMP/readyfile 592 wrote ready: $TESTTMP/readyfile
487 waiting on: $TESTTMP/watchfile 593 waiting on: $TESTTMP/watchfile
503 | | 609 | |
504 | o a9149a1428e2 C-B (default) 610 | o a9149a1428e2 C-B (default)
505 |/ 611 |/
506 @ 842e2fac6304 C-ROOT (default) 612 @ 842e2fac6304 C-ROOT (default)
507 613
614 #endif
615 #if unrelated
616
617 (unrelated named branches are unrelated)
618
619 $ cat ./push-log
620 pushing to ssh://user@dummy/server
621 searching for changes
622 wrote ready: $TESTTMP/readyfile
623 waiting on: $TESTTMP/watchfile
624 remote: adding changesets
625 remote: adding manifests
626 remote: adding file changes
627 remote: added 1 changesets with 1 changes to 1 files (+1 heads)
628
629 $ hg -R server graph
630 o 833be552cfe6 C-H (my-first-test-branch)
631 |
632 | o 75d69cba5402 C-G (default)
633 |/
634 o d9e379a8c432 C-F (default)
635 |
636 o 51c544a58128 C-C (default)
637 |
638 | o d603e2c0cdd7 C-E (default)
639 |/
640 o 98217d5a1659 C-A (default)
641 |
642 | o 59e76faf78bd C-D (default)
643 | |
644 | o a9149a1428e2 C-B (default)
645 |/
646 @ 842e2fac6304 C-ROOT (default)
647
648 #endif
649
650 The racing new head do not affect existing heads, push should go through
508 651
509 pushing touching different named branch (same topo): old branch raced 652 pushing touching different named branch (same topo): old branch raced
510 --------------------------------------------------------------------- 653 ---------------------------------------------------------------------
511 654
512 Pushing two children on the same head, one is a different named branch 655 Pushing two children on the same head, one is a different named branch
517 # |/ 660 # |/
518 # * (default-branch) 661 # * (default-branch)
519 662
520 (resync-all) 663 (resync-all)
521 664
665 #if strict
666
522 $ hg -R ./server pull ./client-racy 667 $ hg -R ./server pull ./client-racy
523 pulling from ./client-racy 668 pulling from ./client-racy
524 searching for changes 669 searching for changes
525 adding changesets 670 adding changesets
526 adding manifests 671 adding manifests
527 adding file changes 672 adding file changes
528 added 1 changesets with 1 changes to 1 files (+1 heads) 673 added 1 changesets with 1 changes to 1 files (+1 heads)
529 (run 'hg heads .' to see heads, 'hg merge' to merge) 674 (run 'hg heads .' to see heads, 'hg merge' to merge)
675
676 #endif
677 #if unrelated
678
679 $ hg -R ./server pull ./client-racy
680 pulling from ./client-racy
681 searching for changes
682 no changes found
683
684 #endif
685
530 $ hg -R ./client-other pull 686 $ hg -R ./client-other pull
531 pulling from ssh://user@dummy/server 687 pulling from ssh://user@dummy/server
532 searching for changes 688 searching for changes
533 adding changesets 689 adding changesets
534 adding manifests 690 adding manifests
598 754
599 $ release $TESTTMP/watchfile 755 $ release $TESTTMP/watchfile
600 756
601 Check the result of the push 757 Check the result of the push
602 758
759 #if strict
760
603 $ cat ./push-log 761 $ cat ./push-log
604 pushing to ssh://user@dummy/server 762 pushing to ssh://user@dummy/server
605 searching for changes 763 searching for changes
606 wrote ready: $TESTTMP/readyfile 764 wrote ready: $TESTTMP/readyfile
607 waiting on: $TESTTMP/watchfile 765 waiting on: $TESTTMP/watchfile
627 | | 785 | |
628 | o a9149a1428e2 C-B (default) 786 | o a9149a1428e2 C-B (default)
629 |/ 787 |/
630 @ 842e2fac6304 C-ROOT (default) 788 @ 842e2fac6304 C-ROOT (default)
631 789
790
791 #endif
792
793 #if unrelated
794
795 (unrelated named branches are unrelated)
796
797 $ cat ./push-log
798 pushing to ssh://user@dummy/server
799 searching for changes
800 wrote ready: $TESTTMP/readyfile
801 waiting on: $TESTTMP/watchfile
802 remote: adding changesets
803 remote: adding manifests
804 remote: adding file changes
805 remote: added 1 changesets with 1 changes to 1 files (+1 heads)
806
807 $ hg -R server graph
808 o 89420bf00fae C-J (default)
809 |
810 | o b35ed749f288 C-I (my-second-test-branch)
811 |/
812 o 75d69cba5402 C-G (default)
813 |
814 | o 833be552cfe6 C-H (my-first-test-branch)
815 |/
816 o d9e379a8c432 C-F (default)
817 |
818 o 51c544a58128 C-C (default)
819 |
820 | o d603e2c0cdd7 C-E (default)
821 |/
822 o 98217d5a1659 C-A (default)
823 |
824 | o 59e76faf78bd C-D (default)
825 | |
826 | o a9149a1428e2 C-B (default)
827 |/
828 @ 842e2fac6304 C-ROOT (default)
829
830
831 #endif
632 832
633 pushing racing push touch multiple heads 833 pushing racing push touch multiple heads
634 ---------------------------------------- 834 ----------------------------------------
635 835
636 There are multiple heads, but the racing push touch all of them 836 There are multiple heads, but the racing push touch all of them
642 # |/ 842 # |/
643 # * 843 # *
644 844
645 (resync-all) 845 (resync-all)
646 846
847 #if strict
848
647 $ hg -R ./server pull ./client-racy 849 $ hg -R ./server pull ./client-racy
648 pulling from ./client-racy 850 pulling from ./client-racy
649 searching for changes 851 searching for changes
650 adding changesets 852 adding changesets
651 adding manifests 853 adding manifests
652 adding file changes 854 adding file changes
653 added 1 changesets with 1 changes to 1 files (+1 heads) 855 added 1 changesets with 1 changes to 1 files (+1 heads)
654 (run 'hg heads .' to see heads, 'hg merge' to merge) 856 (run 'hg heads .' to see heads, 'hg merge' to merge)
857
858 #endif
859
860 #if unrelated
861
862 $ hg -R ./server pull ./client-racy
863 pulling from ./client-racy
864 searching for changes
865 no changes found
866
867 #endif
868
655 $ hg -R ./client-other pull 869 $ hg -R ./client-other pull
656 pulling from ssh://user@dummy/server 870 pulling from ssh://user@dummy/server
657 searching for changes 871 searching for changes
658 adding changesets 872 adding changesets
659 adding manifests 873 adding manifests