##// END OF EJS Templates
copies: add a new test dedicated to testing chain of changeset with merge...
marmoute -
r44762:f9dfb56e default
parent child Browse files
Show More
This diff has been collapsed as it changes many lines, (619 lines changed) Show them Hide them
@@ -0,0 +1,619 b''
1 =====================================================
2 Test Copy tracing for chain of copies involving merge
3 =====================================================
4
5 This test files covers copies/rename case for a chains of commit where merges
6 are involved. It cheks we do not have unwanted update of behavior and that the
7 different options to retrieve copies behave correctly.
8
9 Setup
10 =====
11
12 use git diff to see rename
13
14 $ cat << EOF >> $HGRCPATH
15 > [diff]
16 > git=yes
17 > [ui]
18 > logtemplate={rev} {desc}]\n
19 > EOF
20
21 $ hg init repo-chain
22 $ cd repo-chain
23
24 Add some linear rename initialy
25
26 $ touch a b
27 $ hg ci -Am 'i-0 initial commit: a b'
28 adding a
29 adding b
30 $ hg mv a c
31 $ hg ci -Am 'i-1: a -move-> c'
32 $ hg mv c d
33 $ hg ci -Am 'i-2: c -move-> d'
34 $ hg log -G
35 @ 2 i-2: c -move-> d]
36 |
37 o 1 i-1: a -move-> c]
38 |
39 o 0 i-0 initial commit: a b]
40
41
42 Have a branching with nothing on one side
43
44 $ hg mv d e
45 $ hg ci -Am 'a-1: d -move-> e'
46 $ hg mv e f
47 $ hg ci -Am 'a-2: e -move-> f'
48 $ hg log -G --rev '::.'
49 @ 4 a-2: e -move-> f]
50 |
51 o 3 a-1: d -move-> e]
52 |
53 o 2 i-2: c -move-> d]
54 |
55 o 1 i-1: a -move-> c]
56 |
57 o 0 i-0 initial commit: a b]
58
59
60 And Having another branch with renames on the other side
61
62 $ hg up 'desc("i-2")'
63 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
64 $ echo foo > b
65 $ hg ci -m 'b-1: b update'
66 created new head
67 $ hg log -G --rev '::.'
68 @ 5 b-1: b update]
69 |
70 o 2 i-2: c -move-> d]
71 |
72 o 1 i-1: a -move-> c]
73 |
74 o 0 i-0 initial commit: a b]
75
76
77
78 Merge the two branches we just defined (in both directions)
79 - one with change to an unrelated file
80 - one with renames in them
81
82 $ hg up 'desc("b-1")'
83 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 $ hg merge 'desc("a-2")'
85 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
86 (branch merge, don't forget to commit)
87 $ hg ci -m 'mBAm-0 simple merge - one way'
88 $ hg up 'desc("a-2")'
89 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 $ hg merge 'desc("b-1")'
91 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 (branch merge, don't forget to commit)
93 $ hg ci -m 'mABm-0 simple merge - the other way'
94 created new head
95 $ hg log -G --rev '::(desc("mABm")+desc("mBAm"))'
96 @ 7 mABm-0 simple merge - the other way]
97 |\
98 +---o 6 mBAm-0 simple merge - one way]
99 | |/
100 | o 5 b-1: b update]
101 | |
102 o | 4 a-2: e -move-> f]
103 | |
104 o | 3 a-1: d -move-> e]
105 |/
106 o 2 i-2: c -move-> d]
107 |
108 o 1 i-1: a -move-> c]
109 |
110 o 0 i-0 initial commit: a b]
111
112
113 Create a branch that delete a file previous renamed
114
115 $ hg up 'desc("i-2")'
116 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
117 $ hg rm d
118 $ hg ci -m 'c-1 delete d'
119 created new head
120 $ hg log -G --rev '::.'
121 @ 8 c-1 delete d]
122 |
123 o 2 i-2: c -move-> d]
124 |
125 o 1 i-1: a -move-> c]
126 |
127 o 0 i-0 initial commit: a b]
128
129
130 Merge:
131 - one with change to an unrelated file
132 - one deleting the change
133 and recreate an unrelated file after the merge
134
135 $ hg up 'desc("b-1")'
136 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
137 $ hg merge 'desc("c-1")'
138 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
139 (branch merge, don't forget to commit)
140 $ hg ci -m 'mBCm-0 simple merge - one way'
141 $ echo bar > d
142 $ hg add d
143 $ hg ci -m 'mBCm-1 re-add d'
144 $ hg up 'desc("c-1")'
145 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
146 $ hg merge 'desc("b-1")'
147 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
148 (branch merge, don't forget to commit)
149 $ hg ci -m 'mCBm-0 simple merge - the other way'
150 created new head
151 $ echo bar > d
152 $ hg add d
153 $ hg ci -m 'mCBm-1 re-add d'
154 $ hg log -G --rev '::(desc("mCBm")+desc("mBCm"))'
155 @ 12 mCBm-1 re-add d]
156 |
157 o 11 mCBm-0 simple merge - the other way]
158 |\
159 | | o 10 mBCm-1 re-add d]
160 | | |
161 +---o 9 mBCm-0 simple merge - one way]
162 | |/
163 | o 8 c-1 delete d]
164 | |
165 o | 5 b-1: b update]
166 |/
167 o 2 i-2: c -move-> d]
168 |
169 o 1 i-1: a -move-> c]
170 |
171 o 0 i-0 initial commit: a b]
172
173
174 Create a branch that delete a file previous renamed and recreate it
175
176 $ hg up 'desc("i-2")'
177 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
178 $ hg rm d
179 $ hg ci -m 'd-1 delete d'
180 created new head
181 $ echo bar > d
182 $ hg add d
183 $ hg ci -m 'd-2 re-add d'
184 $ hg log -G --rev '::.'
185 @ 14 d-2 re-add d]
186 |
187 o 13 d-1 delete d]
188 |
189 o 2 i-2: c -move-> d]
190 |
191 o 1 i-1: a -move-> c]
192 |
193 o 0 i-0 initial commit: a b]
194
195
196 Merge:
197 - one with change to an unrelated file
198 - one deleting and recreating the change
199
200 Note:
201 | In this case, the merge get conflicting information since on one side we have
202 | a "brand new" d. and one the other one we have "d renamed from c (itself
203 | renamed from c)".
204 |
205 | The current code arbitrarily pick one side
206
207 $ hg up 'desc("b-1")'
208 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
209 $ hg merge 'desc("d-2")'
210 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
211 (branch merge, don't forget to commit)
212 $ hg ci -m 'mBDm-0 simple merge - one way'
213 $ hg up 'desc("d-2")'
214 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
215 $ hg merge 'desc("b-1")'
216 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
217 (branch merge, don't forget to commit)
218 $ hg ci -m 'mDBm-0 simple merge - the other way'
219 created new head
220 $ hg log -G --rev '::(desc("mDBm")+desc("mBDm"))'
221 @ 16 mDBm-0 simple merge - the other way]
222 |\
223 +---o 15 mBDm-0 simple merge - one way]
224 | |/
225 | o 14 d-2 re-add d]
226 | |
227 | o 13 d-1 delete d]
228 | |
229 o | 5 b-1: b update]
230 |/
231 o 2 i-2: c -move-> d]
232 |
233 o 1 i-1: a -move-> c]
234 |
235 o 0 i-0 initial commit: a b]
236
237
238 Having another branch renaming a different file to the same filename as another
239
240 $ hg up 'desc("i-2")'
241 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
242 $ hg mv b g
243 $ hg ci -m 'e-1 b -move-> g'
244 created new head
245 $ hg mv g f
246 $ hg ci -m 'e-2 g -move-> f'
247 $ hg log -G --rev '::.'
248 @ 18 e-2 g -move-> f]
249 |
250 o 17 e-1 b -move-> g]
251 |
252 o 2 i-2: c -move-> d]
253 |
254 o 1 i-1: a -move-> c]
255 |
256 o 0 i-0 initial commit: a b]
257
258
259 Merge:
260 - one with change to an unrelated file
261 - one deleting and recreating the change
262
263 $ hg up 'desc("a-2")'
264 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
265 $ hg merge 'desc("e-2")'
266 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
267 (branch merge, don't forget to commit)
268 $ hg ci -m 'mAEm-0 simple merge - one way'
269 $ hg up 'desc("e-2")'
270 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
271 $ hg merge 'desc("a-2")'
272 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
273 (branch merge, don't forget to commit)
274 $ hg ci -m 'mEAm-0 simple merge - the other way'
275 created new head
276 $ hg log -G --rev '::(desc("mAEm")+desc("mEAm"))'
277 @ 20 mEAm-0 simple merge - the other way]
278 |\
279 +---o 19 mAEm-0 simple merge - one way]
280 | |/
281 | o 18 e-2 g -move-> f]
282 | |
283 | o 17 e-1 b -move-> g]
284 | |
285 o | 4 a-2: e -move-> f]
286 | |
287 o | 3 a-1: d -move-> e]
288 |/
289 o 2 i-2: c -move-> d]
290 |
291 o 1 i-1: a -move-> c]
292 |
293 o 0 i-0 initial commit: a b]
294
295
296 Note:
297 | In this case, the merge get conflicting information since each side have a
298 | different way to reach 'f'.
299
300 final summary
301
302 $ hg log -G
303 @ 20 mEAm-0 simple merge - the other way]
304 |\
305 +---o 19 mAEm-0 simple merge - one way]
306 | |/
307 | o 18 e-2 g -move-> f]
308 | |
309 | o 17 e-1 b -move-> g]
310 | |
311 | | o 16 mDBm-0 simple merge - the other way]
312 | | |\
313 | | +---o 15 mBDm-0 simple merge - one way]
314 | | | |/
315 | | | o 14 d-2 re-add d]
316 | | | |
317 | +---o 13 d-1 delete d]
318 | | |
319 | | | o 12 mCBm-1 re-add d]
320 | | | |
321 | | | o 11 mCBm-0 simple merge - the other way]
322 | | |/|
323 | | | | o 10 mBCm-1 re-add d]
324 | | | | |
325 | | +---o 9 mBCm-0 simple merge - one way]
326 | | | |/
327 | +---o 8 c-1 delete d]
328 | | |
329 +-----o 7 mABm-0 simple merge - the other way]
330 | | |/
331 +-----o 6 mBAm-0 simple merge - one way]
332 | | |/
333 | | o 5 b-1: b update]
334 | |/
335 o | 4 a-2: e -move-> f]
336 | |
337 o | 3 a-1: d -move-> e]
338 |/
339 o 2 i-2: c -move-> d]
340 |
341 o 1 i-1: a -move-> c]
342 |
343 o 0 i-0 initial commit: a b]
344
345
346 Check results
347 =============
348
349 merging with unrelated change does not interfer wit the renames
350 ---------------------------------------------------------------
351
352 - rename on one side
353 - unrelated change on the other side
354
355 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mABm")'
356 A f
357 d
358 R d
359 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBAm")'
360 A f
361 d
362 R d
363 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mABm")'
364 M b
365 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mBAm")'
366 M b
367 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mABm")'
368 M b
369 A f
370 d
371 R d
372 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBAm")'
373 M b
374 A f
375 d
376 R d
377 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mABm")'
378 M b
379 A f
380 a
381 R a
382 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBAm")'
383 M b
384 A f
385 a
386 R a
387
388 merging with the side having a delete
389 -------------------------------------
390
391 case summary:
392 - one with change to an unrelated file
393 - one deleting the change
394 and recreate an unrelated file after the merge
395
396 checks:
397 - comparing from the merge
398
399 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBCm-0")'
400 R d
401 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCBm-0")'
402 R d
403 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mBCm-0")'
404 M b
405 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCBm-0")'
406 M b
407 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBCm-0")'
408 M b
409 R d
410 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mCBm-0")'
411 M b
412 R d
413 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBCm-0")'
414 M b
415 R a
416 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCBm-0")'
417 M b
418 R a
419
420 - comparing with the merge children re-adding the file
421
422 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBCm-1")'
423 M d
424 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCBm-1")'
425 M d
426 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mBCm-1")'
427 M b
428 A d
429 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCBm-1")'
430 M b
431 A d
432 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBCm-1")'
433 M b
434 M d
435 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mCBm-1")'
436 M b
437 M d
438 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBCm-1")'
439 M b
440 A d
441 R a
442 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCBm-1")'
443 M b
444 A d
445 R a
446
447 Comparing with a merge re-adding the file afterward
448 ---------------------------------------------------
449
450 Merge:
451 - one with change to an unrelated file
452 - one deleting and recreating the change
453
454 Note:
455 | In this case, the merge get conflicting information since on one side we have
456 | a "brand new" d. and one the other one we have "d renamed from c (itself
457 | renamed from c)".
458 |
459 | The current code arbitrarily pick one side
460
461 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBDm-0")'
462 M d
463 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mDBm-0")'
464 M d
465 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mBDm-0")'
466 M b
467 M d
468 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mDBm-0")'
469 M b
470 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBDm-0")'
471 M b
472 M d
473 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mDBm-0")'
474 M b
475 M d
476
477 The recorded copy is different depending of where we started the merge from since
478
479 $ hg manifest --debug --rev 'desc("mBDm-0")' | grep '644 d'
480 0bb5445dc4d02f4e0d86cf16f9f3a411d0f17744 644 d
481 $ hg manifest --debug --rev 'desc("mDBm-0")' | grep '644 d'
482 b004912a8510032a0350a74daa2803dadfb00e12 644 d
483
484 This second b004912a8510032a0350a74daa2803dadfb00e12 seems wrong. We should record the merge
485 $ hg manifest --debug --rev 'desc("d-2")' | grep '644 d'
486 b004912a8510032a0350a74daa2803dadfb00e12 644 d
487 $ hg manifest --debug --rev 'desc("b-1")' | grep '644 d'
488 01c2f5eabdc4ce2bdee42b5f86311955e6c8f573 644 d
489 $ hg debugindex d
490 rev linkrev nodeid p1 p2
491 0 2 01c2f5eabdc4 000000000000 000000000000
492 1 10 b004912a8510 000000000000 000000000000
493 2 15 0bb5445dc4d0 01c2f5eabdc4 b004912a8510
494
495 $ hg log -Gfr 'desc("mBDm-0")' d
496 o 15 mBDm-0 simple merge - one way]
497 |\
498 o : 14 d-2 re-add d]
499 :/
500 o 2 i-2: c -move-> d]
501 |
502 o 1 i-1: a -move-> c]
503 |
504 o 0 i-0 initial commit: a b]
505
506
507 (That output seems wrong, if we had opportunity to record the merge, we should
508 probably have recorded the merge).
509
510 $ hg log -Gfr 'desc("mDBm-0")' d
511 o 14 d-2 re-add d]
512 |
513 ~
514
515 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBDm-0")'
516 M b
517 A d
518 a
519 R a
520 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mDBm-0")'
521 M b
522 A d
523 R a
524
525 Comparing with a merge re-adding the file afterward
526 ---------------------------------------------------
527
528 - one with change to an unrelated file
529 - one deleting and recreating the change
530
531 $ hg manifest --debug --rev 'desc("mAEm-0")' | grep '644 f'
532 eb806e34ef6be4c264effd5933d31004ad15a793 644 f
533 $ hg manifest --debug --rev 'desc("mEAm-0")' | grep '644 f'
534 eb806e34ef6be4c264effd5933d31004ad15a793 644 f
535 $ hg manifest --debug --rev 'desc("a-2")' | grep '644 f'
536 0dd616bc7ab1a111921d95d76f69cda5c2ac539c 644 f
537 $ hg manifest --debug --rev 'desc("e-2")' | grep '644 f'
538 6da5a2eecb9c833f830b67a4972366d49a9a142c 644 f
539 $ hg debugindex f
540 rev linkrev nodeid p1 p2
541 0 4 0dd616bc7ab1 000000000000 000000000000
542 1 18 6da5a2eecb9c 000000000000 000000000000
543 2 19 eb806e34ef6b 0dd616bc7ab1 6da5a2eecb9c
544 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mAEm-0")'
545 M f
546 R b
547 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mEAm-0")'
548 M f
549 R b
550 $ hg status --copies --rev 'desc("e-2")' --rev 'desc("mAEm-0")'
551 M f
552 R d
553 $ hg status --copies --rev 'desc("e-2")' --rev 'desc("mEAm-0")'
554 M f
555 R d
556 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("a-2")'
557 A f
558 d
559 R d
560 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("e-2")'
561 A f
562 b
563 R b
564 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mAEm-0")'
565 A f
566 d
567 R b
568 R d
569 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mEAm-0")'
570 A f
571 d
572 R b
573 R d
574 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAEm-0")'
575 A f
576 a
577 R a
578 R b
579 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEAm-0")'
580 A f
581 a
582 R a
583 R b
584
585 $ hg log -Gfr 'desc("mAEm-0")' f
586 o 19 mAEm-0 simple merge - one way]
587 |\
588 | o 18 e-2 g -move-> f]
589 | |
590 | o 17 e-1 b -move-> g]
591 | |
592 o | 4 a-2: e -move-> f]
593 | |
594 o | 3 a-1: d -move-> e]
595 |/
596 o 2 i-2: c -move-> d]
597 |
598 o 1 i-1: a -move-> c]
599 |
600 o 0 i-0 initial commit: a b]
601
602
603 $ hg log -Gfr 'desc("mEAm-0")' f
604 @ 20 mEAm-0 simple merge - the other way]
605 |\
606 | o 18 e-2 g -move-> f]
607 | |
608 | o 17 e-1 b -move-> g]
609 | |
610 o | 4 a-2: e -move-> f]
611 | |
612 o | 3 a-1: d -move-> e]
613 |/
614 o 2 i-2: c -move-> d]
615 |
616 o 1 i-1: a -move-> c]
617 |
618 o 0 i-0 initial commit: a b]
619
General Comments 0
You need to be logged in to leave comments. Login now