##// END OF EJS Templates
side-data: add a test to check sidedata upgrade...
marmoute -
r46256:8cebc4c1 default
parent child Browse files
Show More
@@ -1,978 +1,1159
1 1 #testcases filelog compatibility sidedata
2 2
3 3 =====================================================
4 4 Test Copy tracing for chain of copies involving merge
5 5 =====================================================
6 6
7 7 This test files covers copies/rename case for a chains of commit where merges
8 8 are involved. It cheks we do not have unwanted update of behavior and that the
9 9 different options to retrieve copies behave correctly.
10 10
11 11
12 12 Setup
13 13 =====
14 14
15 15 use git diff to see rename
16 16
17 17 $ cat << EOF >> $HGRCPATH
18 18 > [diff]
19 19 > git=yes
20 20 > [ui]
21 21 > logtemplate={rev} {desc}\n
22 22 > EOF
23 23
24 24 #if compatibility
25 25 $ cat >> $HGRCPATH << EOF
26 26 > [experimental]
27 27 > copies.read-from = compatibility
28 28 > EOF
29 29 #endif
30 30
31 31 #if sidedata
32 32 $ cat >> $HGRCPATH << EOF
33 33 > [format]
34 34 > exp-use-side-data = yes
35 35 > exp-use-copies-side-data-changeset = yes
36 36 > EOF
37 37 #endif
38 38
39 39
40 40 $ hg init repo-chain
41 41 $ cd repo-chain
42 42
43 43 Add some linear rename initialy
44 44
45 45 $ touch a b h
46 46 $ hg ci -Am 'i-0 initial commit: a b h'
47 47 adding a
48 48 adding b
49 49 adding h
50 50 $ hg mv a c
51 51 $ hg ci -Am 'i-1: a -move-> c'
52 52 $ hg mv c d
53 53 $ hg ci -Am 'i-2: c -move-> d'
54 54 $ hg log -G
55 55 @ 2 i-2: c -move-> d
56 56 |
57 57 o 1 i-1: a -move-> c
58 58 |
59 59 o 0 i-0 initial commit: a b h
60 60
61 61
62 62 And having another branch with renames on the other side
63 63
64 64 $ hg mv d e
65 65 $ hg ci -Am 'a-1: d -move-> e'
66 66 $ hg mv e f
67 67 $ hg ci -Am 'a-2: e -move-> f'
68 68 $ hg log -G --rev '::.'
69 69 @ 4 a-2: e -move-> f
70 70 |
71 71 o 3 a-1: d -move-> e
72 72 |
73 73 o 2 i-2: c -move-> d
74 74 |
75 75 o 1 i-1: a -move-> c
76 76 |
77 77 o 0 i-0 initial commit: a b h
78 78
79 79
80 80 Have a branching with nothing on one side
81 81
82 82 $ hg up 'desc("i-2")'
83 83 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
84 84 $ echo foo > b
85 85 $ hg ci -m 'b-1: b update'
86 86 created new head
87 87 $ hg log -G --rev '::.'
88 88 @ 5 b-1: b update
89 89 |
90 90 o 2 i-2: c -move-> d
91 91 |
92 92 o 1 i-1: a -move-> c
93 93 |
94 94 o 0 i-0 initial commit: a b h
95 95
96 96
97 97 Create a branch that delete a file previous renamed
98 98
99 99 $ hg up 'desc("i-2")'
100 100 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 101 $ hg rm d
102 102 $ hg ci -m 'c-1 delete d'
103 103 created new head
104 104 $ hg log -G --rev '::.'
105 105 @ 6 c-1 delete d
106 106 |
107 107 o 2 i-2: c -move-> d
108 108 |
109 109 o 1 i-1: a -move-> c
110 110 |
111 111 o 0 i-0 initial commit: a b h
112 112
113 113
114 114 Create a branch that delete a file previous renamed and recreate it
115 115
116 116 $ hg up 'desc("i-2")'
117 117 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
118 118 $ hg rm d
119 119 $ hg ci -m 'd-1 delete d'
120 120 created new head
121 121 $ echo bar > d
122 122 $ hg add d
123 123 $ hg ci -m 'd-2 re-add d'
124 124 $ hg log -G --rev '::.'
125 125 @ 8 d-2 re-add d
126 126 |
127 127 o 7 d-1 delete d
128 128 |
129 129 o 2 i-2: c -move-> d
130 130 |
131 131 o 1 i-1: a -move-> c
132 132 |
133 133 o 0 i-0 initial commit: a b h
134 134
135 135
136 136 Having another branch renaming a different file to the same filename as another
137 137
138 138 $ hg up 'desc("i-2")'
139 139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 140 $ hg mv b g
141 141 $ hg ci -m 'e-1 b -move-> g'
142 142 created new head
143 143 $ hg mv g f
144 144 $ hg ci -m 'e-2 g -move-> f'
145 145 $ hg log -G --rev '::.'
146 146 @ 10 e-2 g -move-> f
147 147 |
148 148 o 9 e-1 b -move-> g
149 149 |
150 150 o 2 i-2: c -move-> d
151 151 |
152 152 o 1 i-1: a -move-> c
153 153 |
154 154 o 0 i-0 initial commit: a b h
155 155
156 156
157 157 merging with unrelated change does not interfere with the renames
158 158 ---------------------------------------------------------------
159 159
160 160 - rename on one side
161 161 - unrelated change on the other side
162 162
163 163 $ hg up 'desc("b-1")'
164 164 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
165 165 $ hg merge 'desc("a-2")'
166 166 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
167 167 (branch merge, don't forget to commit)
168 168 $ hg ci -m 'mBAm-0 simple merge - one way'
169 169 $ hg up 'desc("a-2")'
170 170 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
171 171 $ hg merge 'desc("b-1")'
172 172 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
173 173 (branch merge, don't forget to commit)
174 174 $ hg ci -m 'mABm-0 simple merge - the other way'
175 175 created new head
176 176 $ hg log -G --rev '::(desc("mABm")+desc("mBAm"))'
177 177 @ 12 mABm-0 simple merge - the other way
178 178 |\
179 179 +---o 11 mBAm-0 simple merge - one way
180 180 | |/
181 181 | o 5 b-1: b update
182 182 | |
183 183 o | 4 a-2: e -move-> f
184 184 | |
185 185 o | 3 a-1: d -move-> e
186 186 |/
187 187 o 2 i-2: c -move-> d
188 188 |
189 189 o 1 i-1: a -move-> c
190 190 |
191 191 o 0 i-0 initial commit: a b h
192 192
193 193
194 194 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mABm")'
195 195 A f
196 196 d
197 197 R d
198 198 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBAm")'
199 199 A f
200 200 d
201 201 R d
202 202 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mABm")'
203 203 M b
204 204 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mBAm")'
205 205 M b
206 206 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mABm")'
207 207 M b
208 208 A f
209 209 d
210 210 R d
211 211 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBAm")'
212 212 M b
213 213 A f
214 214 d
215 215 R d
216 216 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mABm")'
217 217 M b
218 218 A f
219 219 a
220 220 R a
221 221 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBAm")'
222 222 M b
223 223 A f
224 224 a
225 225 R a
226 226
227 227 merging with the side having a delete
228 228 -------------------------------------
229 229
230 230 case summary:
231 231 - one with change to an unrelated file
232 232 - one deleting the change
233 233 and recreate an unrelated file after the merge
234 234
235 235 $ hg up 'desc("b-1")'
236 236 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
237 237 $ hg merge 'desc("c-1")'
238 238 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
239 239 (branch merge, don't forget to commit)
240 240 $ hg ci -m 'mBCm-0 simple merge - one way'
241 241 $ echo bar > d
242 242 $ hg add d
243 243 $ hg ci -m 'mBCm-1 re-add d'
244 244 $ hg up 'desc("c-1")'
245 245 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
246 246 $ hg merge 'desc("b-1")'
247 247 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
248 248 (branch merge, don't forget to commit)
249 249 $ hg ci -m 'mCBm-0 simple merge - the other way'
250 250 created new head
251 251 $ echo bar > d
252 252 $ hg add d
253 253 $ hg ci -m 'mCBm-1 re-add d'
254 254 $ hg log -G --rev '::(desc("mCBm")+desc("mBCm"))'
255 255 @ 16 mCBm-1 re-add d
256 256 |
257 257 o 15 mCBm-0 simple merge - the other way
258 258 |\
259 259 | | o 14 mBCm-1 re-add d
260 260 | | |
261 261 +---o 13 mBCm-0 simple merge - one way
262 262 | |/
263 263 | o 6 c-1 delete d
264 264 | |
265 265 o | 5 b-1: b update
266 266 |/
267 267 o 2 i-2: c -move-> d
268 268 |
269 269 o 1 i-1: a -move-> c
270 270 |
271 271 o 0 i-0 initial commit: a b h
272 272
273 273 - comparing from the merge
274 274
275 275 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBCm-0")'
276 276 R d
277 277 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCBm-0")'
278 278 R d
279 279 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mBCm-0")'
280 280 M b
281 281 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCBm-0")'
282 282 M b
283 283 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBCm-0")'
284 284 M b
285 285 R d
286 286 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mCBm-0")'
287 287 M b
288 288 R d
289 289 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBCm-0")'
290 290 M b
291 291 R a
292 292 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCBm-0")'
293 293 M b
294 294 R a
295 295
296 296 - comparing with the merge children re-adding the file
297 297
298 298 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBCm-1")'
299 299 M d
300 300 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCBm-1")'
301 301 M d
302 302 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mBCm-1")'
303 303 M b
304 304 A d
305 305 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCBm-1")'
306 306 M b
307 307 A d
308 308 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBCm-1")'
309 309 M b
310 310 M d
311 311 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mCBm-1")'
312 312 M b
313 313 M d
314 314 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBCm-1")'
315 315 M b
316 316 A d
317 317 R a
318 318 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCBm-1")'
319 319 M b
320 320 A d
321 321 R a
322 322
323 323 Comparing with a merge re-adding the file afterward
324 324 ---------------------------------------------------
325 325
326 326 Merge:
327 327 - one with change to an unrelated file
328 328 - one deleting and recreating the change
329 329
330 330 $ hg up 'desc("b-1")'
331 331 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
332 332 $ hg merge 'desc("d-2")'
333 333 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
334 334 (branch merge, don't forget to commit)
335 335 $ hg ci -m 'mBDm-0 simple merge - one way'
336 336 $ hg up 'desc("d-2")'
337 337 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
338 338 $ hg merge 'desc("b-1")'
339 339 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
340 340 (branch merge, don't forget to commit)
341 341 $ hg ci -m 'mDBm-0 simple merge - the other way'
342 342 created new head
343 343 $ hg log -G --rev '::(desc("mDBm")+desc("mBDm"))'
344 344 @ 18 mDBm-0 simple merge - the other way
345 345 |\
346 346 +---o 17 mBDm-0 simple merge - one way
347 347 | |/
348 348 | o 8 d-2 re-add d
349 349 | |
350 350 | o 7 d-1 delete d
351 351 | |
352 352 o | 5 b-1: b update
353 353 |/
354 354 o 2 i-2: c -move-> d
355 355 |
356 356 o 1 i-1: a -move-> c
357 357 |
358 358 o 0 i-0 initial commit: a b h
359 359
360 360 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBDm-0")'
361 361 M d
362 362 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mDBm-0")'
363 363 M d
364 364 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mBDm-0")'
365 365 M b
366 366 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mDBm-0")'
367 367 M b
368 368 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBDm-0")'
369 369 M b
370 370 M d
371 371 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mDBm-0")'
372 372 M b
373 373 M d
374 374
375 375 The bugs makes recorded copy is different depending of where we started the merge from since
376 376
377 377 $ hg manifest --debug --rev 'desc("mBDm-0")' | grep '644 d'
378 378 b004912a8510032a0350a74daa2803dadfb00e12 644 d
379 379 $ hg manifest --debug --rev 'desc("mDBm-0")' | grep '644 d'
380 380 b004912a8510032a0350a74daa2803dadfb00e12 644 d
381 381
382 382 $ hg manifest --debug --rev 'desc("d-2")' | grep '644 d'
383 383 b004912a8510032a0350a74daa2803dadfb00e12 644 d
384 384 $ hg manifest --debug --rev 'desc("b-1")' | grep '644 d'
385 385 01c2f5eabdc4ce2bdee42b5f86311955e6c8f573 644 d
386 386 $ hg debugindex d
387 387 rev linkrev nodeid p1 p2
388 388 0 2 01c2f5eabdc4 000000000000 000000000000
389 389 1 8 b004912a8510 000000000000 000000000000
390 390
391 391 Log output should not include a merge commit as it did not happen
392 392
393 393 $ hg log -Gfr 'desc("mBDm-0")' d
394 394 o 8 d-2 re-add d
395 395 |
396 396 ~
397 397
398 398 $ hg log -Gfr 'desc("mDBm-0")' d
399 399 o 8 d-2 re-add d
400 400 |
401 401 ~
402 402
403 403 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBDm-0")'
404 404 M b
405 405 A d
406 406 R a
407 407 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mDBm-0")'
408 408 M b
409 409 A d
410 410 R a
411 411
412 412
413 413 Comparing with a merge with colliding rename
414 414 --------------------------------------------
415 415
416 416 - the "e-" branch renaming b to f (through 'g')
417 417 - the "a-" branch renaming d to f (through e)
418 418
419 419 $ hg up 'desc("a-2")'
420 420 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
421 421 $ hg merge 'desc("e-2")'
422 422 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
423 423 (branch merge, don't forget to commit)
424 424 $ hg ci -m 'mAEm-0 simple merge - one way'
425 425 $ hg up 'desc("e-2")'
426 426 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
427 427 $ hg merge 'desc("a-2")'
428 428 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
429 429 (branch merge, don't forget to commit)
430 430 $ hg ci -m 'mEAm-0 simple merge - the other way'
431 431 created new head
432 432 $ hg log -G --rev '::(desc("mAEm")+desc("mEAm"))'
433 433 @ 20 mEAm-0 simple merge - the other way
434 434 |\
435 435 +---o 19 mAEm-0 simple merge - one way
436 436 | |/
437 437 | o 10 e-2 g -move-> f
438 438 | |
439 439 | o 9 e-1 b -move-> g
440 440 | |
441 441 o | 4 a-2: e -move-> f
442 442 | |
443 443 o | 3 a-1: d -move-> e
444 444 |/
445 445 o 2 i-2: c -move-> d
446 446 |
447 447 o 1 i-1: a -move-> c
448 448 |
449 449 o 0 i-0 initial commit: a b h
450 450
451 451 $ hg manifest --debug --rev 'desc("mAEm-0")' | grep '644 f'
452 452 eb806e34ef6be4c264effd5933d31004ad15a793 644 f
453 453 $ hg manifest --debug --rev 'desc("mEAm-0")' | grep '644 f'
454 454 eb806e34ef6be4c264effd5933d31004ad15a793 644 f
455 455 $ hg manifest --debug --rev 'desc("a-2")' | grep '644 f'
456 456 0dd616bc7ab1a111921d95d76f69cda5c2ac539c 644 f
457 457 $ hg manifest --debug --rev 'desc("e-2")' | grep '644 f'
458 458 6da5a2eecb9c833f830b67a4972366d49a9a142c 644 f
459 459 $ hg debugindex f
460 460 rev linkrev nodeid p1 p2
461 461 0 4 0dd616bc7ab1 000000000000 000000000000
462 462 1 10 6da5a2eecb9c 000000000000 000000000000
463 463 2 19 eb806e34ef6b 0dd616bc7ab1 6da5a2eecb9c
464 464
465 465 # Here the filelog based implementation is not looking at the rename
466 466 # information (because the file exist on both side). However the changelog
467 467 # based on works fine. We have different output.
468 468
469 469 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mAEm-0")'
470 470 M f
471 471 b (no-filelog !)
472 472 R b
473 473 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mEAm-0")'
474 474 M f
475 475 b (no-filelog !)
476 476 R b
477 477 $ hg status --copies --rev 'desc("e-2")' --rev 'desc("mAEm-0")'
478 478 M f
479 479 d (no-filelog !)
480 480 R d
481 481 $ hg status --copies --rev 'desc("e-2")' --rev 'desc("mEAm-0")'
482 482 M f
483 483 d (no-filelog !)
484 484 R d
485 485 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("a-2")'
486 486 A f
487 487 d
488 488 R d
489 489 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("e-2")'
490 490 A f
491 491 b
492 492 R b
493 493
494 494 # From here, we run status against revision where both source file exists.
495 495 #
496 496 # The filelog based implementation picks an arbitrary side based on revision
497 497 # numbers. So the same side "wins" whatever the parents order is. This is
498 498 # sub-optimal because depending on revision numbers means the result can be
499 499 # different from one repository to the next.
500 500 #
501 501 # The changeset based algorithm use the parent order to break tie on conflicting
502 502 # information and will have a different order depending on who is p1 and p2.
503 503 # That order is stable accross repositories. (data from p1 prevails)
504 504
505 505 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mAEm-0")'
506 506 A f
507 507 d
508 508 R b
509 509 R d
510 510 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mEAm-0")'
511 511 A f
512 512 d (filelog !)
513 513 b (no-filelog !)
514 514 R b
515 515 R d
516 516 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAEm-0")'
517 517 A f
518 518 a
519 519 R a
520 520 R b
521 521 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEAm-0")'
522 522 A f
523 523 a (filelog !)
524 524 b (no-filelog !)
525 525 R a
526 526 R b
527 527
528 528
529 529 Note:
530 530 | In this case, one of the merge wrongly record a merge while there is none.
531 531 | This lead to bad copy tracing information to be dug up.
532 532
533 533
534 534 Merge:
535 535 - one with change to an unrelated file (b)
536 536 - one overwriting a file (d) with a rename (from h to i to d)
537 537
538 538 $ hg up 'desc("i-2")'
539 539 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
540 540 $ hg mv h i
541 541 $ hg commit -m "f-1: rename h -> i"
542 542 created new head
543 543 $ hg mv --force i d
544 544 $ hg commit -m "f-2: rename i -> d"
545 545 $ hg debugindex d
546 546 rev linkrev nodeid p1 p2
547 547 0 2 01c2f5eabdc4 000000000000 000000000000
548 548 1 8 b004912a8510 000000000000 000000000000
549 549 2 22 c72365ee036f 000000000000 000000000000
550 550 $ hg up 'desc("b-1")'
551 551 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
552 552 $ hg merge 'desc("f-2")'
553 553 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
554 554 (branch merge, don't forget to commit)
555 555 $ hg ci -m 'mBFm-0 simple merge - one way'
556 556 $ hg up 'desc("f-2")'
557 557 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
558 558 $ hg merge 'desc("b-1")'
559 559 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
560 560 (branch merge, don't forget to commit)
561 561 $ hg ci -m 'mFBm-0 simple merge - the other way'
562 562 created new head
563 563 $ hg log -G --rev '::(desc("mBFm")+desc("mFBm"))'
564 564 @ 24 mFBm-0 simple merge - the other way
565 565 |\
566 566 +---o 23 mBFm-0 simple merge - one way
567 567 | |/
568 568 | o 22 f-2: rename i -> d
569 569 | |
570 570 | o 21 f-1: rename h -> i
571 571 | |
572 572 o | 5 b-1: b update
573 573 |/
574 574 o 2 i-2: c -move-> d
575 575 |
576 576 o 1 i-1: a -move-> c
577 577 |
578 578 o 0 i-0 initial commit: a b h
579 579
580 580 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBFm-0")'
581 581 M b
582 582 A d
583 583 h
584 584 R a
585 585 R h
586 586 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mFBm-0")'
587 587 M b
588 588 A d
589 589 h
590 590 R a
591 591 R h
592 592 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBFm-0")'
593 593 M d
594 594 h (no-filelog !)
595 595 R h
596 596 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mBFm-0")'
597 597 M b
598 598 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mBFm-0")'
599 599 M b
600 600 M d
601 601 i (no-filelog !)
602 602 R i
603 603 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mFBm-0")'
604 604 M d
605 605 h (no-filelog !)
606 606 R h
607 607 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mFBm-0")'
608 608 M b
609 609 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mFBm-0")'
610 610 M b
611 611 M d
612 612 i (no-filelog !)
613 613 R i
614 614
615 615 $ hg log -Gfr 'desc("mBFm-0")' d
616 616 o 22 f-2: rename i -> d
617 617 |
618 618 o 21 f-1: rename h -> i
619 619 :
620 620 o 0 i-0 initial commit: a b h
621 621
622 622
623 623 $ hg log -Gfr 'desc("mFBm-0")' d
624 624 o 22 f-2: rename i -> d
625 625 |
626 626 o 21 f-1: rename h -> i
627 627 :
628 628 o 0 i-0 initial commit: a b h
629 629
630 630
631 631
632 632 Merge:
633 633 - one with change to a file
634 634 - one deleting and recreating the file
635 635
636 636 Unlike in the 'BD/DB' cases, an actual merge happened here. So we should
637 637 consider history and rename on both branch of the merge.
638 638
639 639 $ hg up 'desc("i-2")'
640 640 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
641 641 $ echo "some update" >> d
642 642 $ hg commit -m "g-1: update d"
643 643 created new head
644 644 $ hg up 'desc("d-2")'
645 645 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
646 646 $ hg merge 'desc("g-1")' --tool :union
647 647 merging d
648 648 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
649 649 (branch merge, don't forget to commit)
650 650 $ hg ci -m 'mDGm-0 simple merge - one way'
651 651 $ hg up 'desc("g-1")'
652 652 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
653 653 $ hg merge 'desc("d-2")' --tool :union
654 654 merging d
655 655 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
656 656 (branch merge, don't forget to commit)
657 657 $ hg ci -m 'mGDm-0 simple merge - the other way'
658 658 created new head
659 659 $ hg log -G --rev '::(desc("mDGm")+desc("mGDm"))'
660 660 @ 27 mGDm-0 simple merge - the other way
661 661 |\
662 662 +---o 26 mDGm-0 simple merge - one way
663 663 | |/
664 664 | o 25 g-1: update d
665 665 | |
666 666 o | 8 d-2 re-add d
667 667 | |
668 668 o | 7 d-1 delete d
669 669 |/
670 670 o 2 i-2: c -move-> d
671 671 |
672 672 o 1 i-1: a -move-> c
673 673 |
674 674 o 0 i-0 initial commit: a b h
675 675
676 676 One side of the merge have a long history with rename. The other side of the
677 677 merge point to a new file with a smaller history. Each side is "valid".
678 678
679 679 (and again the filelog based algorithm only explore one, with a pick based on
680 680 revision numbers)
681 681
682 682 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mDGm-0")'
683 683 A d
684 684 a (filelog !)
685 685 R a
686 686 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGDm-0")'
687 687 A d
688 688 a
689 689 R a
690 690 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mDGm-0")'
691 691 M d
692 692 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mGDm-0")'
693 693 M d
694 694 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mDGm-0")'
695 695 M d
696 696 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mGDm-0")'
697 697 M d
698 698
699 699 $ hg log -Gfr 'desc("mDGm-0")' d
700 700 o 26 mDGm-0 simple merge - one way
701 701 |\
702 702 | o 25 g-1: update d
703 703 | |
704 704 o | 8 d-2 re-add d
705 705 |/
706 706 o 2 i-2: c -move-> d
707 707 |
708 708 o 1 i-1: a -move-> c
709 709 |
710 710 o 0 i-0 initial commit: a b h
711 711
712 712
713 713
714 714 $ hg log -Gfr 'desc("mDGm-0")' d
715 715 o 26 mDGm-0 simple merge - one way
716 716 |\
717 717 | o 25 g-1: update d
718 718 | |
719 719 o | 8 d-2 re-add d
720 720 |/
721 721 o 2 i-2: c -move-> d
722 722 |
723 723 o 1 i-1: a -move-> c
724 724 |
725 725 o 0 i-0 initial commit: a b h
726 726
727 727
728 728
729 729 Merge:
730 730 - one with change to a file (d)
731 731 - one overwriting that file with a rename (from h to i, to d)
732 732
733 733 This case is similar to BF/FB, but an actual merge happens, so both side of the
734 734 history are relevant.
735 735
736 736 Note:
737 737 | In this case, the merge get conflicting information since on one side we have
738 738 | "a -> c -> d". and one the other one we have "h -> i -> d".
739 739 |
740 740 | The current code arbitrarily pick one side
741 741
742 742 $ hg up 'desc("f-2")'
743 743 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
744 744 $ hg merge 'desc("g-1")' --tool :union
745 745 merging d
746 746 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
747 747 (branch merge, don't forget to commit)
748 748 $ hg ci -m 'mFGm-0 simple merge - one way'
749 749 created new head
750 750 $ hg up 'desc("g-1")'
751 751 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
752 752 $ hg merge 'desc("f-2")' --tool :union
753 753 merging d
754 754 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
755 755 (branch merge, don't forget to commit)
756 756 $ hg ci -m 'mGFm-0 simple merge - the other way'
757 757 created new head
758 758 $ hg log -G --rev '::(desc("mGFm")+desc("mFGm"))'
759 759 @ 29 mGFm-0 simple merge - the other way
760 760 |\
761 761 +---o 28 mFGm-0 simple merge - one way
762 762 | |/
763 763 | o 25 g-1: update d
764 764 | |
765 765 o | 22 f-2: rename i -> d
766 766 | |
767 767 o | 21 f-1: rename h -> i
768 768 |/
769 769 o 2 i-2: c -move-> d
770 770 |
771 771 o 1 i-1: a -move-> c
772 772 |
773 773 o 0 i-0 initial commit: a b h
774 774
775 775 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mFGm-0")'
776 776 A d
777 777 h (no-filelog !)
778 778 a (filelog !)
779 779 R a
780 780 R h
781 781 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGFm-0")'
782 782 A d
783 783 a
784 784 R a
785 785 R h
786 786 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mFGm-0")'
787 787 M d
788 788 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mGFm-0")'
789 789 M d
790 790 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mFGm-0")'
791 791 M d
792 792 i (no-filelog !)
793 793 R i
794 794 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mGFm-0")'
795 795 M d
796 796 i (no-filelog !)
797 797 R i
798 798 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mFGm-0")'
799 799 M d
800 800 h (no-filelog !)
801 801 R h
802 802 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mGFm-0")'
803 803 M d
804 804 h (no-filelog !)
805 805 R h
806 806
807 807 $ hg log -Gfr 'desc("mFGm-0")' d
808 808 o 28 mFGm-0 simple merge - one way
809 809 |\
810 810 | o 25 g-1: update d
811 811 | |
812 812 o | 22 f-2: rename i -> d
813 813 | |
814 814 o | 21 f-1: rename h -> i
815 815 |/
816 816 o 2 i-2: c -move-> d
817 817 |
818 818 o 1 i-1: a -move-> c
819 819 |
820 820 o 0 i-0 initial commit: a b h
821 821
822 822
823 823 $ hg log -Gfr 'desc("mGFm-0")' d
824 824 @ 29 mGFm-0 simple merge - the other way
825 825 |\
826 826 | o 25 g-1: update d
827 827 | |
828 828 o | 22 f-2: rename i -> d
829 829 | |
830 830 o | 21 f-1: rename h -> i
831 831 |/
832 832 o 2 i-2: c -move-> d
833 833 |
834 834 o 1 i-1: a -move-> c
835 835 |
836 836 o 0 i-0 initial commit: a b h
837 837
838 838
839 839
840 840 Comparing with merging with a deletion (and keeping the file)
841 841 -------------------------------------------------------------
842 842
843 843 Merge:
844 844 - one removing a file (d)
845 845 - one updating that file
846 846 - the merge keep the modified version of the file (canceling the delete)
847 847
848 848 In this case, the file keep on living after the merge. So we should not drop its
849 849 copy tracing chain.
850 850
851 851 $ hg up 'desc("c-1")'
852 852 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
853 853 $ hg merge 'desc("g-1")'
854 854 file 'd' was deleted in local [working copy] but was modified in other [merge rev].
855 855 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
856 856 What do you want to do? u
857 857 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
858 858 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
859 859 [1]
860 860 $ hg resolve -t :other d
861 861 (no more unresolved files)
862 862 $ hg ci -m "mCGm-0"
863 863 created new head
864 864
865 865 $ hg up 'desc("g-1")'
866 866 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
867 867 $ hg merge 'desc("c-1")'
868 868 file 'd' was deleted in other [merge rev] but was modified in local [working copy].
869 869 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
870 870 What do you want to do? u
871 871 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
872 872 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
873 873 [1]
874 874 $ hg resolve -t :local d
875 875 (no more unresolved files)
876 876 $ hg ci -m "mGCm-0"
877 877 created new head
878 878
879 879 $ hg log -G --rev '::(desc("mCGm")+desc("mGCm"))'
880 880 @ 31 mGCm-0
881 881 |\
882 882 +---o 30 mCGm-0
883 883 | |/
884 884 | o 25 g-1: update d
885 885 | |
886 886 o | 6 c-1 delete d
887 887 |/
888 888 o 2 i-2: c -move-> d
889 889 |
890 890 o 1 i-1: a -move-> c
891 891 |
892 892 o 0 i-0 initial commit: a b h
893 893
894 894
895 895 BROKEN: 'a' should be the the source of 'd' in the changeset centric algorithm too
896 896
897 897 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCGm-0")'
898 898 A d
899 899 a (filelog !)
900 900 R a
901 901 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGCm-0")'
902 902 A d
903 903 a (filelog !)
904 904 R a
905 905 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCGm-0")'
906 906 A d
907 907 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mGCm-0")'
908 908 A d
909 909 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mCGm-0")'
910 910 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mGCm-0")'
911 911
912 912
913 913 Comparing with merge restoring an untouched deleted file
914 914 --------------------------------------------------------
915 915
916 916 Merge:
917 917 - one removing a file (d)
918 918 - one leaving the file untouched
919 919 - the merge actively restore the file to the same content.
920 920
921 921 In this case, the file keep on living after the merge. So we should not drop its
922 922 copy tracing chain.
923 923
924 924 $ hg up 'desc("c-1")'
925 925 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
926 926 $ hg merge 'desc("b-1")'
927 927 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
928 928 (branch merge, don't forget to commit)
929 929 $ hg revert --rev 'desc("b-1")' d
930 930 $ hg ci -m "mCB-revert-m-0"
931 931 created new head
932 932
933 933 $ hg up 'desc("b-1")'
934 934 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
935 935 $ hg merge 'desc("c-1")'
936 936 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
937 937 (branch merge, don't forget to commit)
938 938 $ hg revert --rev 'desc("b-1")' d
939 939 $ hg ci -m "mBC-revert-m-0"
940 940 created new head
941 941
942 942 $ hg log -G --rev '::(desc("mCB-revert-m")+desc("mBC-revert-m"))'
943 943 @ 33 mBC-revert-m-0
944 944 |\
945 945 +---o 32 mCB-revert-m-0
946 946 | |/
947 947 | o 6 c-1 delete d
948 948 | |
949 949 o | 5 b-1: b update
950 950 |/
951 951 o 2 i-2: c -move-> d
952 952 |
953 953 o 1 i-1: a -move-> c
954 954 |
955 955 o 0 i-0 initial commit: a b h
956 956
957 957
958 958 BROKEN: 'a' should be the the source of 'd' in the changeset centric algorithm too
959 959
960 960 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCB-revert-m-0")'
961 961 M b
962 962 A d
963 963 a (filelog !)
964 964 R a
965 965 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBC-revert-m-0")'
966 966 M b
967 967 A d
968 968 a (filelog !)
969 969 R a
970 970 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCB-revert-m-0")'
971 971 M b
972 972 A d
973 973 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mBC-revert-m-0")'
974 974 M b
975 975 A d
976 976 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCB-revert-m-0")'
977 977 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBC-revert-m-0")'
978 978
979
980 Test that sidedata computations during upgrades ares correct
981 ============================================================
982
983 We upgrade a repository that is not using sidedata (the filelog case) and
984 check that the same side data have been generated as if they were computed at
985 commit time.
986
987
988 #if filelog
989 $ cat >> $HGRCPATH << EOF
990 > [format]
991 > exp-use-side-data = yes
992 > exp-use-copies-side-data-changeset = yes
993 > EOF
994 $ hg debugformat -v
995 format-variant repo config default
996 fncache: yes yes yes
997 dotencode: yes yes yes
998 generaldelta: yes yes yes
999 sparserevlog: yes yes yes
1000 sidedata: no yes no
1001 persistent-nodemap: no no no
1002 copies-sdc: no yes no
1003 plain-cl-delta: yes yes yes
1004 compression: * (glob)
1005 compression-level: default default default
1006 $ hg debugupgraderepo --run --quiet
1007 upgrade will perform the following actions:
1008
1009 requirements
1010 preserved: * (glob)
1011 added: exp-copies-sidedata-changeset, exp-sidedata-flag
1012
1013 #endif
1014
1015
1016 #if no-compatibility
1017
1018 $ for rev in `hg log --rev 'all()' -T '{rev}\n'`; do
1019 > echo "##### revision $rev #####"
1020 > hg debugsidedata -c -v -- $rev
1021 > done
1022 ##### revision 0 #####
1023 1 sidedata entries
1024 entry-0014 size 34
1025 '\x00\x00\x00\x03\x04\x00\x00\x00\x01\x00\x00\x00\x00\x04\x00\x00\x00\x02\x00\x00\x00\x00\x04\x00\x00\x00\x03\x00\x00\x00\x00abh'
1026 ##### revision 1 #####
1027 1 sidedata entries
1028 entry-0014 size 24
1029 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00ac'
1030 ##### revision 2 #####
1031 1 sidedata entries
1032 entry-0014 size 24
1033 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00cd'
1034 ##### revision 3 #####
1035 1 sidedata entries
1036 entry-0014 size 24
1037 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00de'
1038 ##### revision 4 #####
1039 1 sidedata entries
1040 entry-0014 size 24
1041 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00ef'
1042 ##### revision 5 #####
1043 1 sidedata entries
1044 entry-0014 size 14
1045 '\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00b'
1046 ##### revision 6 #####
1047 1 sidedata entries
1048 entry-0014 size 14
1049 '\x00\x00\x00\x01\x0c\x00\x00\x00\x01\x00\x00\x00\x00d'
1050 ##### revision 7 #####
1051 1 sidedata entries
1052 entry-0014 size 14
1053 '\x00\x00\x00\x01\x0c\x00\x00\x00\x01\x00\x00\x00\x00d'
1054 ##### revision 8 #####
1055 1 sidedata entries
1056 entry-0014 size 14
1057 '\x00\x00\x00\x01\x04\x00\x00\x00\x01\x00\x00\x00\x00d'
1058 ##### revision 9 #####
1059 1 sidedata entries
1060 entry-0014 size 24
1061 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00bg'
1062 ##### revision 10 #####
1063 1 sidedata entries
1064 entry-0014 size 24
1065 '\x00\x00\x00\x02\x06\x00\x00\x00\x01\x00\x00\x00\x01\x0c\x00\x00\x00\x02\x00\x00\x00\x00fg'
1066 ##### revision 11 #####
1067 1 sidedata entries
1068 entry-0014 size 4
1069 '\x00\x00\x00\x00'
1070 ##### revision 12 #####
1071 1 sidedata entries
1072 entry-0014 size 4
1073 '\x00\x00\x00\x00'
1074 ##### revision 13 #####
1075 1 sidedata entries
1076 entry-0014 size 4
1077 '\x00\x00\x00\x00'
1078 ##### revision 14 #####
1079 1 sidedata entries
1080 entry-0014 size 14
1081 '\x00\x00\x00\x01\x04\x00\x00\x00\x01\x00\x00\x00\x00d'
1082 ##### revision 15 #####
1083 1 sidedata entries
1084 entry-0014 size 4
1085 '\x00\x00\x00\x00'
1086 ##### revision 16 #####
1087 1 sidedata entries
1088 entry-0014 size 14
1089 '\x00\x00\x00\x01\x04\x00\x00\x00\x01\x00\x00\x00\x00d'
1090 ##### revision 17 #####
1091 1 sidedata entries
1092 entry-0014 size 4
1093 '\x00\x00\x00\x00'
1094 ##### revision 18 #####
1095 1 sidedata entries
1096 entry-0014 size 4
1097 '\x00\x00\x00\x00'
1098 ##### revision 19 #####
1099 1 sidedata entries
1100 entry-0014 size 14
1101 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00f'
1102 ##### revision 20 #####
1103 1 sidedata entries
1104 entry-0014 size 14
1105 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00f'
1106 ##### revision 21 #####
1107 1 sidedata entries
1108 entry-0014 size 24
1109 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00hi'
1110 ##### revision 22 #####
1111 1 sidedata entries
1112 entry-0014 size 24
1113 '\x00\x00\x00\x02\x16\x00\x00\x00\x01\x00\x00\x00\x01\x0c\x00\x00\x00\x02\x00\x00\x00\x00di'
1114 ##### revision 23 #####
1115 1 sidedata entries
1116 entry-0014 size 4
1117 '\x00\x00\x00\x00'
1118 ##### revision 24 #####
1119 1 sidedata entries
1120 entry-0014 size 4
1121 '\x00\x00\x00\x00'
1122 ##### revision 25 #####
1123 1 sidedata entries
1124 entry-0014 size 14
1125 '\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00d'
1126 ##### revision 26 #####
1127 1 sidedata entries
1128 entry-0014 size 14
1129 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
1130 ##### revision 27 #####
1131 1 sidedata entries
1132 entry-0014 size 14
1133 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
1134 ##### revision 28 #####
1135 1 sidedata entries
1136 entry-0014 size 14
1137 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
1138 ##### revision 29 #####
1139 1 sidedata entries
1140 entry-0014 size 14
1141 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
1142 ##### revision 30 #####
1143 1 sidedata entries
1144 entry-0014 size 4
1145 '\x00\x00\x00\x00'
1146 ##### revision 31 #####
1147 1 sidedata entries
1148 entry-0014 size 4
1149 '\x00\x00\x00\x00'
1150 ##### revision 32 #####
1151 1 sidedata entries
1152 entry-0014 size 4
1153 '\x00\x00\x00\x00'
1154 ##### revision 33 #####
1155 1 sidedata entries
1156 entry-0014 size 4
1157 '\x00\x00\x00\x00'
1158
1159 #endif
General Comments 0
You need to be logged in to leave comments. Login now