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