##// END OF EJS Templates
copies-tests: update the analysis of the BD/DB cases...
marmoute -
r44939:b8882f5d default
parent child Browse files
Show More
@@ -1,584 +1,586 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 - one deleting and recreating the change
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 - one with change to an unrelated file
261 261 - one deleting and recreating the change
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 | In this case, the merge get conflicting information since each side have a
298 | different way to reach 'f'.
297 | In this case, one of the merge wrongly record a merge while there is none.
298 | This lead to bad copy tracing information to be dug up.
299 299
300 300 final summary
301 301
302 302 $ hg update null --quiet
303 303 $ hg log -G
304 304 o 20 mEAm-0 simple merge - the other way]
305 305 |\
306 306 +---o 19 mAEm-0 simple merge - one way]
307 307 | |/
308 308 | o 18 e-2 g -move-> f]
309 309 | |
310 310 | o 17 e-1 b -move-> g]
311 311 | |
312 312 | | o 16 mDBm-0 simple merge - the other way]
313 313 | | |\
314 314 | | +---o 15 mBDm-0 simple merge - one way]
315 315 | | | |/
316 316 | | | o 14 d-2 re-add d]
317 317 | | | |
318 318 | +---o 13 d-1 delete d]
319 319 | | |
320 320 | | | o 12 mCBm-1 re-add d]
321 321 | | | |
322 322 | | | o 11 mCBm-0 simple merge - the other way]
323 323 | | |/|
324 324 | | | | o 10 mBCm-1 re-add d]
325 325 | | | | |
326 326 | | +---o 9 mBCm-0 simple merge - one way]
327 327 | | | |/
328 328 | +---o 8 c-1 delete d]
329 329 | | |
330 330 +-----o 7 mABm-0 simple merge - the other way]
331 331 | | |/
332 332 +-----o 6 mBAm-0 simple merge - one way]
333 333 | | |/
334 334 | | o 5 b-1: b update]
335 335 | |/
336 336 o | 4 a-2: e -move-> f]
337 337 | |
338 338 o | 3 a-1: d -move-> e]
339 339 |/
340 340 o 2 i-2: c -move-> d]
341 341 |
342 342 o 1 i-1: a -move-> c]
343 343 |
344 344 o 0 i-0 initial commit: a b]
345 345
346 346
347 347 Check results
348 348 =============
349 349
350 350 merging with unrelated change does not interfer wit the renames
351 351 ---------------------------------------------------------------
352 352
353 353 - rename on one side
354 354 - unrelated change on the other side
355 355
356 356 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mABm")'
357 357 A f
358 358 d
359 359 R d
360 360 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBAm")'
361 361 A f
362 362 d
363 363 R d
364 364 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mABm")'
365 365 M b
366 366 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mBAm")'
367 367 M b
368 368 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mABm")'
369 369 M b
370 370 A f
371 371 d
372 372 R d
373 373 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBAm")'
374 374 M b
375 375 A f
376 376 d
377 377 R d
378 378 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mABm")'
379 379 M b
380 380 A f
381 381 a
382 382 R a
383 383 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBAm")'
384 384 M b
385 385 A f
386 386 a
387 387 R a
388 388
389 389 merging with the side having a delete
390 390 -------------------------------------
391 391
392 392 case summary:
393 393 - one with change to an unrelated file
394 394 - one deleting the change
395 395 and recreate an unrelated file after the merge
396 396
397 397 checks:
398 398 - comparing from the merge
399 399
400 400 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBCm-0")'
401 401 R d
402 402 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCBm-0")'
403 403 R d
404 404 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mBCm-0")'
405 405 M b
406 406 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCBm-0")'
407 407 M b
408 408 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBCm-0")'
409 409 M b
410 410 R d
411 411 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mCBm-0")'
412 412 M b
413 413 R d
414 414 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBCm-0")'
415 415 M b
416 416 R a
417 417 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCBm-0")'
418 418 M b
419 419 R a
420 420
421 421 - comparing with the merge children re-adding the file
422 422
423 423 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBCm-1")'
424 424 M d
425 425 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCBm-1")'
426 426 M d
427 427 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mBCm-1")'
428 428 M b
429 429 A d
430 430 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCBm-1")'
431 431 M b
432 432 A d
433 433 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBCm-1")'
434 434 M b
435 435 M d
436 436 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mCBm-1")'
437 437 M b
438 438 M d
439 439 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBCm-1")'
440 440 M b
441 441 A d
442 442 R a
443 443 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCBm-1")'
444 444 M b
445 445 A d
446 446 R a
447 447
448 448 Comparing with a merge re-adding the file afterward
449 449 ---------------------------------------------------
450 450
451 451 Merge:
452 452 - one with change to an unrelated file
453 453 - one deleting and recreating the change
454 454
455 455 Note:
456 | In this case, the merge get conflicting information since on one side we have
457 | a "brand new" d. and one the other one we have "d renamed from c (itself
458 | renamed from c)".
459 |
460 | The current code arbitrarily pick one side
456 | In this case, one of the merge wrongly record a merge while there is none.
457 | This lead to bad copy tracing information to be dug up.
461 458
462 459 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBDm-0")'
463 460 M d
464 461 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mDBm-0")'
465 462 M d
466 463 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mBDm-0")'
467 464 M b
468 465 M d
469 466 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mDBm-0")'
470 467 M b
471 468 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBDm-0")'
472 469 M b
473 470 M d
474 471 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mDBm-0")'
475 472 M b
476 473 M d
477 474
478 The recorded copy is different depending of where we started the merge from since
475 The bugs makes recorded copy is different depending of where we started the merge from since
479 476
480 477 $ hg manifest --debug --rev 'desc("mBDm-0")' | grep '644 d'
481 478 0bb5445dc4d02f4e0d86cf16f9f3a411d0f17744 644 d
482 479 $ hg manifest --debug --rev 'desc("mDBm-0")' | grep '644 d'
483 480 b004912a8510032a0350a74daa2803dadfb00e12 644 d
484 481
485 This second b004912a8510032a0350a74daa2803dadfb00e12 seems wrong. We should record the merge
482 The 0bb5445dc4d02f4e0d86cf16f9f3a411d0f17744 entry is wrong, since the file was
483 deleted on one side (then recreate) and untouched on the other side, no "merge"
484 has happened. The resulting `d` file is the untouched version from branch `D`,
485 not a merge.
486
486 487 $ hg manifest --debug --rev 'desc("d-2")' | grep '644 d'
487 488 b004912a8510032a0350a74daa2803dadfb00e12 644 d
488 489 $ hg manifest --debug --rev 'desc("b-1")' | grep '644 d'
489 490 01c2f5eabdc4ce2bdee42b5f86311955e6c8f573 644 d
490 491 $ hg debugindex d
491 492 rev linkrev nodeid p1 p2
492 493 0 2 01c2f5eabdc4 000000000000 000000000000
493 494 1 10 b004912a8510 000000000000 000000000000
494 495 2 15 0bb5445dc4d0 01c2f5eabdc4 b004912a8510
495 496
497 (This `hg log` output if wrong, since no merge actually happened).
498
496 499 $ hg log -Gfr 'desc("mBDm-0")' d
497 500 o 15 mBDm-0 simple merge - one way]
498 501 |\
499 502 o : 14 d-2 re-add d]
500 503 :/
501 504 o 2 i-2: c -move-> d]
502 505 |
503 506 o 1 i-1: a -move-> c]
504 507 |
505 508 o 0 i-0 initial commit: a b]
506 509
507 510
508 (That output seems wrong, if we had opportunity to record the merge, we should
509 probably have recorded the merge).
511 This `hg log` output is correct
510 512
511 513 $ hg log -Gfr 'desc("mDBm-0")' d
512 514 o 14 d-2 re-add d]
513 515 |
514 516 ~
515 517
516 518 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBDm-0")'
517 519 M b
518 520 A d
519 521 a
520 522 R a
521 523 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mDBm-0")'
522 524 M b
523 525 A d
524 526 R a
525 527
526 528 Comparing with a merge re-adding the file afterward
527 529 ---------------------------------------------------
528 530
529 531 - one with change to an unrelated file
530 532 - one deleting and recreating the change
531 533
532 534 $ hg manifest --debug --rev 'desc("mAEm-0")' | grep '644 f'
533 535 eb806e34ef6be4c264effd5933d31004ad15a793 644 f
534 536 $ hg manifest --debug --rev 'desc("mEAm-0")' | grep '644 f'
535 537 eb806e34ef6be4c264effd5933d31004ad15a793 644 f
536 538 $ hg manifest --debug --rev 'desc("a-2")' | grep '644 f'
537 539 0dd616bc7ab1a111921d95d76f69cda5c2ac539c 644 f
538 540 $ hg manifest --debug --rev 'desc("e-2")' | grep '644 f'
539 541 6da5a2eecb9c833f830b67a4972366d49a9a142c 644 f
540 542 $ hg debugindex f
541 543 rev linkrev nodeid p1 p2
542 544 0 4 0dd616bc7ab1 000000000000 000000000000
543 545 1 18 6da5a2eecb9c 000000000000 000000000000
544 546 2 19 eb806e34ef6b 0dd616bc7ab1 6da5a2eecb9c
545 547 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mAEm-0")'
546 548 M f
547 549 R b
548 550 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mEAm-0")'
549 551 M f
550 552 R b
551 553 $ hg status --copies --rev 'desc("e-2")' --rev 'desc("mAEm-0")'
552 554 M f
553 555 R d
554 556 $ hg status --copies --rev 'desc("e-2")' --rev 'desc("mEAm-0")'
555 557 M f
556 558 R d
557 559 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("a-2")'
558 560 A f
559 561 d
560 562 R d
561 563 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("e-2")'
562 564 A f
563 565 b
564 566 R b
565 567 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mAEm-0")'
566 568 A f
567 569 d
568 570 R b
569 571 R d
570 572 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mEAm-0")'
571 573 A f
572 574 d
573 575 R b
574 576 R d
575 577 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAEm-0")'
576 578 A f
577 579 a
578 580 R a
579 581 R b
580 582 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEAm-0")'
581 583 A f
582 584 a
583 585 R a
584 586 R b
General Comments 0
You need to be logged in to leave comments. Login now