Debian Codegraph @

tests/test-merge-types.t

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