##// END OF EJS Templates
test-merge-types.t: add tests for :merge-local/:merge-other with symlinks...
Siddharth Agarwal -
r26892:4b966aaa default
parent child Browse files
Show More
@@ -1,395 +1,439 b''
1 1 #require symlink execbit
2 2
3 3 $ tellmeabout() {
4 4 > if [ -h $1 ]; then
5 5 > echo $1 is a symlink:
6 6 > $TESTDIR/readlink.py $1
7 7 > elif [ -x $1 ]; then
8 8 > echo $1 is an executable file with content:
9 9 > cat $1
10 10 > else
11 11 > echo $1 is a plain file with content:
12 12 > cat $1
13 13 > fi
14 14 > }
15 15
16 16 $ hg init test1
17 17 $ cd test1
18 18
19 19 $ echo a > a
20 20 $ hg ci -Aqmadd
21 21 $ chmod +x a
22 22 $ hg ci -mexecutable
23 23
24 24 $ hg up -q 0
25 25 $ rm a
26 26 $ ln -s symlink a
27 27 $ hg ci -msymlink
28 28 created new head
29 29
30 30 Symlink is local parent, executable is other:
31 31
32 32 $ hg merge --debug
33 33 searching for copies back to rev 1
34 34 resolving manifests
35 35 branchmerge: True, force: False, partial: False
36 36 ancestor: c334dc3be0da, local: 521a1e40188f+, remote: 3574f3e69b1c
37 37 preserving a for resolve of a
38 38 a: versions differ -> m (premerge)
39 39 picked tool ':merge' for a (binary False symlink True)
40 40 merging a
41 41 my a@521a1e40188f+ other a@3574f3e69b1c ancestor a@c334dc3be0da
42 42 warning: internal :merge cannot merge symlinks for a
43 43 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
44 44 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
45 45 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
46 46 [1]
47 47
48 48 $ tellmeabout a
49 49 a is a symlink:
50 50 a -> symlink
51 51 $ hg resolve a --tool internal:other
52 52 (no more unresolved files)
53 53 $ tellmeabout a
54 54 a is an executable file with content:
55 55 a
56 56 $ hg st
57 57 M a
58 58 ? a.orig
59 59
60 60 Symlink is other parent, executable is local:
61 61
62 62 $ hg update -C 1
63 63 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
64 64
65 65 $ hg merge --debug --tool :union
66 66 searching for copies back to rev 1
67 67 resolving manifests
68 68 branchmerge: True, force: False, partial: False
69 69 ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
70 70 preserving a for resolve of a
71 71 a: versions differ -> m (premerge)
72 72 picked tool ':union' for a (binary False symlink True)
73 73 merging a
74 74 my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da
75 75 warning: internal :union cannot merge symlinks for a
76 76 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
77 77 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
78 78 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
79 79 [1]
80 80
81 81 $ tellmeabout a
82 82 a is an executable file with content:
83 83 a
84 84
85 85 $ hg update -C 1
86 86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
87 87
88 88 $ hg merge --debug --tool :merge3
89 89 searching for copies back to rev 1
90 90 resolving manifests
91 91 branchmerge: True, force: False, partial: False
92 92 ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
93 93 preserving a for resolve of a
94 94 a: versions differ -> m (premerge)
95 95 picked tool ':merge3' for a (binary False symlink True)
96 96 merging a
97 97 my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da
98 98 warning: internal :merge3 cannot merge symlinks for a
99 99 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
100 100 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
101 101 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
102 102 [1]
103 103
104 104 $ tellmeabout a
105 105 a is an executable file with content:
106 106 a
107 107
108 $ hg update -C 1
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
110
111 $ hg merge --debug --tool :merge-local
112 searching for copies back to rev 1
113 resolving manifests
114 branchmerge: True, force: False, partial: False
115 ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
116 preserving a for resolve of a
117 a: versions differ -> m (premerge)
118 picked tool ':merge-local' for a (binary False symlink True)
119 merging a
120 my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da
121 warning: :merge-local cannot merge symlinks for a
122 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
123 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
124 [1]
125
126 $ tellmeabout a
127 a is an executable file with content:
128 a
129
130 $ hg update -C 1
131 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
132
133 $ hg merge --debug --tool :merge-other
134 searching for copies back to rev 1
135 resolving manifests
136 branchmerge: True, force: False, partial: False
137 ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
138 preserving a for resolve of a
139 a: versions differ -> m (premerge)
140 picked tool ':merge-other' for a (binary False symlink True)
141 merging a
142 my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da
143 warning: :merge-other cannot merge symlinks for a
144 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
145 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
146 [1]
147
148 $ tellmeabout a
149 a is an executable file with content:
150 a
151
108 152 Update to link without local change should get us a symlink (issue3316):
109 153
110 154 $ hg up -C 0
111 155 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
112 156 $ hg up
113 157 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
114 158 $ hg st
115 159 ? a.orig
116 160
117 161 Update to link with local change should cause a merge prompt (issue3200):
118 162
119 163 $ hg up -Cq 0
120 164 $ echo data > a
121 165 $ HGMERGE= hg up -y --debug
122 166 searching for copies back to rev 2
123 167 resolving manifests
124 168 branchmerge: False, force: False, partial: False
125 169 ancestor: c334dc3be0da, local: c334dc3be0da+, remote: 521a1e40188f
126 170 preserving a for resolve of a
127 171 a: versions differ -> m (premerge)
128 172 (couldn't find merge tool hgmerge|tool hgmerge can't handle symlinks) (re)
129 173 picked tool ':prompt' for a (binary False symlink True)
130 174 no tool found to merge a
131 175 keep (l)ocal or take (o)ther? l
132 176 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
133 177 $ hg diff --git
134 178 diff --git a/a b/a
135 179 old mode 120000
136 180 new mode 100644
137 181 --- a/a
138 182 +++ b/a
139 183 @@ -1,1 +1,1 @@
140 184 -symlink
141 185 \ No newline at end of file
142 186 +data
143 187
144 188
145 189 Test only 'l' change - happens rarely, except when recovering from situations
146 190 where that was what happened.
147 191
148 192 $ hg init test2
149 193 $ cd test2
150 194 $ printf base > f
151 195 $ hg ci -Aqm0
152 196 $ echo file > f
153 197 $ echo content >> f
154 198 $ hg ci -qm1
155 199 $ hg up -qr0
156 200 $ rm f
157 201 $ ln -s base f
158 202 $ hg ci -qm2
159 203 $ hg merge
160 204 merging f
161 205 warning: internal :merge cannot merge symlinks for f
162 206 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
163 207 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
164 208 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
165 209 [1]
166 210 $ tellmeabout f
167 211 f is a symlink:
168 212 f -> base
169 213
170 214 $ hg up -Cqr1
171 215 $ hg merge
172 216 merging f
173 217 warning: internal :merge cannot merge symlinks for f
174 218 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
175 219 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
176 220 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
177 221 [1]
178 222 $ tellmeabout f
179 223 f is a plain file with content:
180 224 file
181 225 content
182 226
183 227 $ cd ..
184 228
185 229 Test removed 'x' flag merged with change to symlink
186 230
187 231 $ hg init test3
188 232 $ cd test3
189 233 $ echo f > f
190 234 $ chmod +x f
191 235 $ hg ci -Aqm0
192 236 $ chmod -x f
193 237 $ hg ci -qm1
194 238 $ hg up -qr0
195 239 $ rm f
196 240 $ ln -s dangling f
197 241 $ hg ci -qm2
198 242 $ hg merge
199 243 merging f
200 244 warning: internal :merge cannot merge symlinks for f
201 245 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
202 246 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
203 247 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
204 248 [1]
205 249 $ tellmeabout f
206 250 f is a symlink:
207 251 f -> dangling
208 252
209 253 $ hg up -Cqr1
210 254 $ hg merge
211 255 merging f
212 256 warning: internal :merge cannot merge symlinks for f
213 257 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
214 258 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
215 259 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
216 260 [1]
217 261 $ tellmeabout f
218 262 f is a plain file with content:
219 263 f
220 264
221 265 Test removed 'x' flag merged with content change - both ways
222 266
223 267 $ hg up -Cqr0
224 268 $ echo change > f
225 269 $ hg ci -qm3
226 270 $ hg merge -r1
227 271 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
228 272 (branch merge, don't forget to commit)
229 273 $ tellmeabout f
230 274 f is a plain file with content:
231 275 change
232 276
233 277 $ hg up -qCr1
234 278 $ hg merge -r3
235 279 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
236 280 (branch merge, don't forget to commit)
237 281 $ tellmeabout f
238 282 f is a plain file with content:
239 283 change
240 284
241 285 $ cd ..
242 286
243 287 Test merge with no common ancestor:
244 288 a: just different
245 289 b: x vs -, different (cannot calculate x, cannot ask merge tool)
246 290 c: x vs -, same (cannot calculate x, merge tool is no good)
247 291 d: x vs l, different
248 292 e: x vs l, same
249 293 f: - vs l, different
250 294 g: - vs l, same
251 295 h: l vs l, different
252 296 (where same means the filelog entry is shared and there thus is an ancestor!)
253 297
254 298 $ hg init test4
255 299 $ cd test4
256 300 $ echo 0 > 0
257 301 $ hg ci -Aqm0
258 302
259 303 $ echo 1 > a
260 304 $ echo 1 > b
261 305 $ chmod +x b
262 306 $ echo x > c
263 307 $ chmod +x c
264 308 $ echo 1 > d
265 309 $ chmod +x d
266 310 $ printf x > e
267 311 $ chmod +x e
268 312 $ echo 1 > f
269 313 $ printf x > g
270 314 $ ln -s 1 h
271 315 $ hg ci -qAm1
272 316
273 317 $ hg up -qr0
274 318 $ echo 2 > a
275 319 $ echo 2 > b
276 320 $ echo x > c
277 321 $ ln -s 2 d
278 322 $ ln -s x e
279 323 $ ln -s 2 f
280 324 $ ln -s x g
281 325 $ ln -s 2 h
282 326 $ hg ci -Aqm2
283 327
284 328 $ hg merge
285 329 merging a
286 330 warning: cannot merge flags for b
287 331 merging b
288 332 warning: cannot merge flags for c
289 333 merging d
290 334 warning: internal :merge cannot merge symlinks for d
291 335 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
292 336 merging f
293 337 warning: internal :merge cannot merge symlinks for f
294 338 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
295 339 merging h
296 340 warning: internal :merge cannot merge symlinks for h
297 341 warning: conflicts while merging h! (edit, then use 'hg resolve --mark')
298 342 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
299 343 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
300 344 3 files updated, 0 files merged, 0 files removed, 5 files unresolved
301 345 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
302 346 [1]
303 347 $ hg resolve -l
304 348 U a
305 349 U b
306 350 U d
307 351 U f
308 352 U h
309 353 $ tellmeabout a
310 354 a is a plain file with content:
311 355 <<<<<<< local: 0139c5610547 - test: 2
312 356 2
313 357 =======
314 358 1
315 359 >>>>>>> other: 97e29675e796 - test: 1
316 360 $ tellmeabout b
317 361 b is a plain file with content:
318 362 <<<<<<< local: 0139c5610547 - test: 2
319 363 2
320 364 =======
321 365 1
322 366 >>>>>>> other: 97e29675e796 - test: 1
323 367 $ tellmeabout c
324 368 c is a plain file with content:
325 369 x
326 370 $ tellmeabout d
327 371 d is a symlink:
328 372 d -> 2
329 373 $ tellmeabout e
330 374 e is a symlink:
331 375 e -> x
332 376 $ tellmeabout f
333 377 f is a symlink:
334 378 f -> 2
335 379 $ tellmeabout g
336 380 g is a symlink:
337 381 g -> x
338 382 $ tellmeabout h
339 383 h is a symlink:
340 384 h -> 2
341 385
342 386 $ hg up -Cqr1
343 387 $ hg merge
344 388 merging a
345 389 warning: cannot merge flags for b
346 390 merging b
347 391 warning: cannot merge flags for c
348 392 merging d
349 393 warning: internal :merge cannot merge symlinks for d
350 394 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
351 395 merging f
352 396 warning: internal :merge cannot merge symlinks for f
353 397 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
354 398 merging h
355 399 warning: internal :merge cannot merge symlinks for h
356 400 warning: conflicts while merging h! (edit, then use 'hg resolve --mark')
357 401 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
358 402 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
359 403 3 files updated, 0 files merged, 0 files removed, 5 files unresolved
360 404 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
361 405 [1]
362 406 $ tellmeabout a
363 407 a is a plain file with content:
364 408 <<<<<<< local: 97e29675e796 - test: 1
365 409 1
366 410 =======
367 411 2
368 412 >>>>>>> other: 0139c5610547 - test: 2
369 413 $ tellmeabout b
370 414 b is an executable file with content:
371 415 <<<<<<< local: 97e29675e796 - test: 1
372 416 1
373 417 =======
374 418 2
375 419 >>>>>>> other: 0139c5610547 - test: 2
376 420 $ tellmeabout c
377 421 c is an executable file with content:
378 422 x
379 423 $ tellmeabout d
380 424 d is an executable file with content:
381 425 1
382 426 $ tellmeabout e
383 427 e is an executable file with content:
384 428 x (no-eol)
385 429 $ tellmeabout f
386 430 f is a plain file with content:
387 431 1
388 432 $ tellmeabout g
389 433 g is a plain file with content:
390 434 x (no-eol)
391 435 $ tellmeabout h
392 436 h is a symlink:
393 437 h -> 1
394 438
395 439 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now