comparison tests/test-push-race.t @ 32637:9234d2cb24a5

test: add a push race case where non-contiguous branch head are created We check case where the raced push an update to branch default head while the racing push update that same head but through another named branch.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 27 May 2017 22:27:41 +0200
parents da5cf8cc5aad
children 4f6645ec6bb2
comparison
equal deleted inserted replaced
32636:da5cf8cc5aad 32637:9234d2cb24a5
893 | | 893 | |
894 | o 98217d5a1659 C-A (default) 894 | o 98217d5a1659 C-A (default)
895 |/ 895 |/
896 @ 842e2fac6304 C-ROOT (default) 896 @ 842e2fac6304 C-ROOT (default)
897 897
898
899 racing commit push a new head behind another named branch
900 ---------------------------------------------------------
901
902 non-continuous branch are valid case, we tests for them.
903
904 # b (branch default)
905 # |
906 # o (branch foo)
907 # |
908 # | a (raced, branch default)
909 # |/
910 # * (branch foo)
911 # |
912 # * (branch default)
913
914 (resync-all + other branch)
915
916 $ hg -R ./server pull ./client-racy
917 pulling from ./client-racy
918 searching for changes
919 adding changesets
920 adding manifests
921 adding file changes
922 added 1 changesets with 0 changes to 0 files
923 (run 'hg update' to get a working copy)
924
925 (creates named branch on head)
926
927 $ hg -R ./server/ up 'desc("C-N")'
928 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
929 $ hg -R ./server/ branch other
930 marked working directory as branch other
931 $ hg -R ./server/ ci -m "C-Z"
932 $ hg -R ./server/ up null
933 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
934
935 (sync client)
936
937 $ hg -R ./client-other pull
938 pulling from ssh://user@dummy/server
939 searching for changes
940 adding changesets
941 adding manifests
942 adding file changes
943 added 2 changesets with 0 changes to 0 files
944 (run 'hg update' to get a working copy)
945 $ hg -R ./client-racy pull
946 pulling from ssh://user@dummy/server
947 searching for changes
948 adding changesets
949 adding manifests
950 adding file changes
951 added 2 changesets with 1 changes to 1 files (+1 heads)
952 (run 'hg heads .' to see heads, 'hg merge' to merge)
953
954 $ hg -R server graph
955 o 55a6f1c01b48 C-Z (other)
956 |
957 o 866a66e18630 C-N (default)
958 |\
959 +---o 6fd3090135df C-M (default)
960 | |
961 | o cac2cead0ff0 C-L (default)
962 | |
963 o | be705100c623 C-K (default)
964 |\|
965 o | d603e2c0cdd7 C-E (default)
966 | |
967 | o 59e76faf78bd C-D (default)
968 | |
969 | | o 89420bf00fae C-J (default)
970 | | |
971 | | | o b35ed749f288 C-I (my-second-test-branch)
972 | | |/
973 | | o 75d69cba5402 C-G (default)
974 | | |
975 | | | o 833be552cfe6 C-H (my-first-test-branch)
976 | | |/
977 | | o d9e379a8c432 C-F (default)
978 | | |
979 +---o 51c544a58128 C-C (default)
980 | |
981 | o a9149a1428e2 C-B (default)
982 | |
983 o | 98217d5a1659 C-A (default)
984 |/
985 o 842e2fac6304 C-ROOT (default)
986
987
988 Creating changesets
989
990 (update default head through another named branch one)
991
992 $ hg -R client-other/ up 'desc("C-Z")'
993 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
994 $ echo aaa >> client-other/a
995 $ hg -R client-other/ commit -m "C-O"
996 $ echo aaa >> client-other/a
997 $ hg -R client-other/ branch --force default
998 marked working directory as branch default
999 $ hg -R client-other/ commit -m "C-P"
1000 created new head
1001
1002 (update default head)
1003
1004 $ hg -R client-racy/ up 'desc("C-Z")'
1005 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1006 $ echo bbb >> client-other/a
1007 $ hg -R client-racy/ branch --force default
1008 marked working directory as branch default
1009 $ hg -R client-racy/ commit -m "C-Q"
1010 created new head
1011
1012 Pushing
1013
1014 $ hg -R client-racy push -r 'tip' > ./push-log 2>&1 &
1015
1016 $ waiton $TESTTMP/readyfile
1017
1018 $ hg -R client-other push -fr 'tip' --new-branch
1019 pushing to ssh://user@dummy/server
1020 searching for changes
1021 remote: adding changesets
1022 remote: adding manifests
1023 remote: adding file changes
1024 remote: added 2 changesets with 1 changes to 1 files
1025
1026 $ release $TESTTMP/watchfile
1027
1028 Check the result of the push
1029
1030 $ cat ./push-log
1031 pushing to ssh://user@dummy/server
1032 searching for changes
1033 wrote ready: $TESTTMP/readyfile
1034 waiting on: $TESTTMP/watchfile
1035 abort: push failed:
1036 'repository changed while pushing - please try again'
1037
1038 $ hg -R server graph
1039 o 1b58ee3f79e5 C-P (default)
1040 |
1041 o d0a85b2252a9 C-O (other)
1042 |
1043 o 55a6f1c01b48 C-Z (other)
1044 |
1045 o 866a66e18630 C-N (default)
1046 |\
1047 +---o 6fd3090135df C-M (default)
1048 | |
1049 | o cac2cead0ff0 C-L (default)
1050 | |
1051 o | be705100c623 C-K (default)
1052 |\|
1053 o | d603e2c0cdd7 C-E (default)
1054 | |
1055 | o 59e76faf78bd C-D (default)
1056 | |
1057 | | o 89420bf00fae C-J (default)
1058 | | |
1059 | | | o b35ed749f288 C-I (my-second-test-branch)
1060 | | |/
1061 | | o 75d69cba5402 C-G (default)
1062 | | |
1063 | | | o 833be552cfe6 C-H (my-first-test-branch)
1064 | | |/
1065 | | o d9e379a8c432 C-F (default)
1066 | | |
1067 +---o 51c544a58128 C-C (default)
1068 | |
1069 | o a9149a1428e2 C-B (default)
1070 | |
1071 o | 98217d5a1659 C-A (default)
1072 |/
1073 o 842e2fac6304 C-ROOT (default)
1074