monotone

monotone Mtn Source Tree

Root/tests/t_cross.at

1# -*- Autoconf -*-
2
3AT_SETUP([creating a bad criss-cross merge])
4
5MONOTONE_SETUP
6
7# this test demonstrates a tricky case in which two parties, bob and
8# alice, merge a fork, left and right, differently. bob chooses the
9# changes in the left node, alice chooses the changes in the right
10# node.
11#
12# the result of merging their merges incorrectly succeeds, considering
13# the LCA(bob,alice) as either foo or bar, and thereby seeing one of
14# the edges (left->bob or right->alice) as having "no changes", and
15# letting the edge "with changes" (right->bob, or left->alice) clobber
16# it.
17#
18# this should be fixed so the merge-of-merges conflicts.
19
20AT_DATA(shared.anc, [base version data
21])
22AT_DATA(shared.left, [conflicting data on left side
23])
24AT_DATA(shared.right, [conflicting data on right side
25])
26AT_DATA(specific.left, [non-conflicting mergeable data on left side
27])
28AT_DATA(specific.right, [non-conflicting mergeable data on right side
29])
30AT_DATA(specific.alice, [non-conflicting mergeable data in bob
31])
32AT_DATA(specific.bob, [non-conflicting mergeable data in alice
33])
34
35# construct ancestor
36AT_CHECK(cp shared.anc shared)
37AT_CHECK(MONOTONE add shared, [], [ignore], [ignore])
38AT_CHECK(MONOTONE --branch=testbranch commit ancestor, [], [ignore], [ignore])
39ROOT_M_SHA=`SHA1(MT/manifest)`
40ROOT_F_SHA=`SHA1(shared)`
41
42# construct left node
43AT_CHECK(cp shared.left shared)
44AT_CHECK(MONOTONE add specific.left, [], [ignore], [ignore])
45AT_CHECK(MONOTONE commit left, [], [ignore], [ignore])
46LEFT_M_SHA=`SHA1(MT/manifest)`
47LEFT_F_SHA=`SHA1(shared)`
48AT_CHECK(test $LEFT_M_SHA != $ROOT_M_SHA)
49AT_CHECK(test $LEFT_F_SHA != $ROOT_F_SHA)
50
51# revert to root
52PROBE_NODE(shared, $ROOT_M_SHA, $ROOT_F_SHA)
53
54# construct right node
55AT_CHECK(cp shared.right shared)
56AT_CHECK(MONOTONE add specific.right, [], [ignore], [ignore])
57AT_CHECK(MONOTONE commit right, [], [ignore], [ignore])
58RIGHT_M_SHA=`SHA1(MT/manifest)`
59RIGHT_F_SHA=`SHA1(shared)`
60AT_CHECK(test $RIGHT_M_SHA != $ROOT_M_SHA)
61AT_CHECK(test $RIGHT_F_SHA != $ROOT_F_SHA)
62AT_CHECK(test $RIGHT_M_SHA != $LEFT_M_SHA)
63AT_CHECK(test $RIGHT_F_SHA != $LEFT_F_SHA)
64
65# construct alice, a derivative of right but with the specific change
66# in left, and an ancestor edge to left.
67AT_CHECK(MONOTONE add specific.left, [], [ignore], [ignore])
68AT_CHECK(MONOTONE add specific.alice, [], [ignore], [ignore])
69AT_CHECK(MONOTONE commit alice, [], [ignore], [ignore])
70ALICE_M_SHA=`SHA1(MT/manifest)`
71AT_CHECK(MONOTONE cert manifest $ALICE_M_SHA ancestor $LEFT_M_SHA, [], [ignore], [ignore])
72
73# revert to left
74PROBE_NODE(shared, $LEFT_M_SHA, $LEFT_F_SHA)
75AT_CHECK(grep specific.right MT/manifest, [1])
76
77# construct bob, a derivative of left but with the specific change
78# in right, and an ancestor edge to right.
79AT_CHECK(MONOTONE add specific.right, [], [ignore], [ignore])
80AT_CHECK(MONOTONE add specific.bob, [], [ignore], [ignore])
81AT_CHECK(MONOTONE commit bob, [], [ignore], [ignore])
82BOB_M_SHA=`SHA1(MT/manifest)`
83AT_CHECK(MONOTONE cert manifest $BOB_M_SHA ancestor $RIGHT_M_SHA, [], [ignore], [ignore])
84
85# now merge the merges. this *should* fail.
86AT_CHECK(MONOTONE --branch=testbranch merge, [1], [ignore], [ignore])
87
88AT_CLEANUP

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status