Follow upstream changes -- rest
[git-darcs-import.git] / tests / conflict-doppleganger.sh
blobf1d08ec431a116f858cc8edd47563507fcd9ed24
1 #!/usr/bin/env bash
2 set -ev
4 ## The builtin ! has the wrong semantics for not.
5 not () { "$@" && exit 1 || :; }
7 # Tests for the doppleganger conflict bug.
9 # For Zooko, with love
10 # Also, for issue81.
12 rm -rf temp
13 mkdir temp
14 cd temp
16 # check that dopplegangers conflict in --old-fashioned
17 rm -rf tmp_dopple tmp_ganger
18 mkdir tmp_dopple
19 cd tmp_dopple
20 darcs init --old-fashioned
22 darcs show repo | grep darcs-1.0
23 touch a.txt
24 darcs add a.txt
25 darcs record -A base -am 'adding a.txt'
26 cd ..
28 darcs get tmp_dopple tmp_ganger
30 for repo in tmp_dopple tmp_ganger; do
31 echo working on $repo
32 cd $repo
33 echo "text which appears in both places at once" > a.txt
34 darcs record -A $repo -am "recording an identical change in $repo"
35 cd ..
36 done
38 # Now that the conflict has been set up, try pull one patch from the other.
39 cd tmp_ganger
40 darcs pull -a ../tmp_dopple > out
41 cat out
42 grep 'conflict' out
44 # check that dopplegangers conflict in --hashed
45 rm -rf tmp_dopple tmp_ganger
46 mkdir tmp_dopple
47 cd tmp_dopple
48 darcs init --hashed
50 darcs show repo | grep hashed
51 touch a.txt
52 darcs add a.txt
53 darcs record -A base -am 'adding a.txt'
54 cd ..
56 darcs get tmp_dopple tmp_ganger
58 for repo in tmp_dopple tmp_ganger; do
59 echo working on $repo
60 cd $repo
61 echo "text which appears in both places at once" > a.txt
62 darcs record -A $repo -am "recording an identical change in $repo"
63 cd ..
64 done
66 # Now that the conflict has been set up, try pull one patch from the other.
67 cd tmp_ganger
68 darcs pull -a ../tmp_dopple > out
69 cat out
70 grep 'conflict' out
71 cd ..
73 # check that dopplegangers do not conflict in --darcs-2
74 rm -rf tmp_dopple tmp_ganger
75 mkdir tmp_dopple
76 cd tmp_dopple
77 darcs init --darcs-2
79 darcs show repo | grep darcs-2
80 touch a.txt
81 darcs add a.txt
82 darcs record -A base -am 'adding a.txt'
83 cd ..
85 darcs get tmp_dopple tmp_ganger
87 for repo in tmp_dopple tmp_ganger; do
88 echo working on $repo
89 cd $repo
90 echo "text which appears in both places at once" > a.txt
91 darcs record -A $repo -am "recording an identical change in $repo"
92 cd ..
93 done
95 # Now that the conflict has been set up, try pull one patch from the other.
96 cd tmp_ganger
97 darcs pull -a ../tmp_dopple > out
98 cat out
99 not grep 'conflict' out
100 cd ..
102 # Checking that resolution dopplegangers conflict in --old-fashioned-inventory
103 rm -rf temp0 temp1 temp2 tmp_dopple tmp_ganger
104 mkdir temp0
105 cd temp0
106 darcs init --old-fashioned-inventory
107 darcs show repo | grep darcs-1.0
108 cd ..
110 # Create a conflict
111 darcs get --old-fashioned-inventory temp0 temp1
112 cd temp1
113 darcs show repo
114 darcs show repo | grep darcs-1.0
115 echo temp1 > a.txt
116 darcs add a.txt
117 darcs record -A base -am 'adding temp1 a.txt'
118 cd ..
119 darcs get temp0 temp2
120 cd temp2
121 echo temp2 > a.txt
122 darcs add a.txt
123 darcs record -A base -am 'adding temp2 a.txt'
124 cd ..
126 # Resolve the conflict the same way on both sides
127 for repo in tmp_dopple tmp_ganger; do
128 echo working on $repo
129 darcs get temp1 $repo
130 cd $repo
131 darcs pull -a ../temp2
132 echo "text which appears in both places at once" > a.txt
133 darcs record -A $repo -am "recording an identical change in $repo"
134 cd ..
135 done
137 # Now that the conflict has been set up, try pull one patch from the other.
138 cd tmp_ganger
139 darcs pull -a ../tmp_dopple > out
140 cat out
141 grep conflict out
142 cd ..
144 # Checking that resolution dopplegangers conflict in --hashed
145 rm -rf temp0 temp1 temp2 tmp_dopple tmp_ganger
146 mkdir temp0
147 cd temp0
148 darcs init --hashed
149 darcs show repo | grep hashed
150 cd ..
152 # Create a conflict
153 darcs get temp0 temp1
154 cd temp1
155 echo temp1 > a.txt
156 darcs add a.txt
157 darcs record -A base -am 'adding temp1 a.txt'
158 cd ..
159 darcs get temp0 temp2
160 cd temp2
161 echo temp2 > a.txt
162 darcs add a.txt
163 darcs record -A base -am 'adding temp2 a.txt'
164 cd ..
166 # Resolve the conflict the same way on both sides
167 for repo in tmp_dopple tmp_ganger; do
168 echo working on $repo
169 darcs get temp1 $repo
170 cd $repo
171 darcs pull -a ../temp2
172 echo "text which appears in both places at once" > a.txt
173 darcs record -A $repo -am "recording an identical change in $repo"
174 cd ..
175 done
177 # Now that the conflict has been set up, try pull one patch from the other.
178 cd tmp_ganger
179 darcs pull -a ../tmp_dopple > out
180 cat out
181 grep conflict out
182 cd ..
185 # Checking that resolution dopplegangers do not conflict in --darcs-2
186 rm -rf temp0 temp1 temp2 tmp_dopple tmp_ganger
187 mkdir temp0
188 cd temp0
189 darcs init --darcs-2
190 darcs show repo | grep darcs-2
191 cd ..
193 # Create a conflict
194 darcs get temp0 temp1
195 cd temp1
196 darcs show repo | grep darcs-2
197 echo temp1 > a.txt
198 darcs add a.txt
199 darcs record -A base -am 'adding temp1 a.txt'
200 cd ..
201 darcs get temp0 temp2
202 cd temp2
203 echo temp2 > a.txt
204 darcs add a.txt
205 darcs record -A base -am 'adding temp2 a.txt'
206 cd ..
208 # Resolve the conflict the same way on both sides
209 for repo in tmp_dopple tmp_ganger; do
210 echo working on $repo
211 darcs get temp1 $repo
212 cd $repo
213 darcs pull -a ../temp2
214 echo "text which appears in both places at once" > a.txt
215 darcs record -A $repo -am "recording an identical change in $repo"
216 cd ..
217 done
219 # Now that the conflict has been set up, try pull one patch from the other.
220 cd tmp_ganger
221 darcs pull -a ../tmp_dopple > out
222 cat out
223 not grep conflict out
224 cd ..
226 cd ..
227 rm -rf temp