##// END OF EJS Templates
tests: avoid the word "dirty" to mean "not a descendant of merge base"...
Martin von Zweigbergk -
r42458:cbff7f99 default
parent child Browse files
Show More
@@ -1,644 +1,644
1 1 #testcases filelog compatibility changeset
2 2
3 3 $ cat >> $HGRCPATH << EOF
4 4 > [extensions]
5 5 > rebase=
6 6 > [alias]
7 7 > l = log -G -T '{rev} {desc}\n{files}\n'
8 8 > EOF
9 9
10 10 #if compatibility
11 11 $ cat >> $HGRCPATH << EOF
12 12 > [experimental]
13 13 > copies.read-from = compatibility
14 14 > EOF
15 15 #endif
16 16
17 17 #if changeset
18 18 $ cat >> $HGRCPATH << EOF
19 19 > [experimental]
20 20 > copies.read-from = changeset-only
21 21 > copies.write-to = changeset-only
22 22 > EOF
23 23 #endif
24 24
25 25 $ REPONUM=0
26 26 $ newrepo() {
27 27 > cd $TESTTMP
28 28 > REPONUM=`expr $REPONUM + 1`
29 29 > hg init repo-$REPONUM
30 30 > cd repo-$REPONUM
31 31 > }
32 32
33 33 Simple rename case
34 34 $ newrepo
35 35 $ echo x > x
36 36 $ hg ci -Aqm 'add x'
37 37 $ hg mv x y
38 38 $ hg debugp1copies
39 39 x -> y
40 40 $ hg debugp2copies
41 41 $ hg ci -m 'rename x to y'
42 42 $ hg l
43 43 @ 1 rename x to y
44 44 | x y
45 45 o 0 add x
46 46 x
47 47 $ hg debugp1copies -r 1
48 48 x -> y
49 49 $ hg debugpathcopies 0 1
50 50 x -> y
51 51 $ hg debugpathcopies 1 0
52 52 y -> x
53 53 Test filtering copies by path. We do filtering by destination.
54 54 $ hg debugpathcopies 0 1 x
55 55 $ hg debugpathcopies 1 0 x
56 56 y -> x
57 57 $ hg debugpathcopies 0 1 y
58 58 x -> y
59 59 $ hg debugpathcopies 1 0 y
60 60
61 61 Copy a file onto another file
62 62 $ newrepo
63 63 $ echo x > x
64 64 $ echo y > y
65 65 $ hg ci -Aqm 'add x and y'
66 66 $ hg cp -f x y
67 67 $ hg debugp1copies
68 68 x -> y
69 69 $ hg debugp2copies
70 70 $ hg ci -m 'copy x onto y'
71 71 $ hg l
72 72 @ 1 copy x onto y
73 73 | y
74 74 o 0 add x and y
75 75 x y
76 76 $ hg debugp1copies -r 1
77 77 x -> y
78 78 Incorrectly doesn't show the rename
79 79 $ hg debugpathcopies 0 1
80 80
81 81 Copy a file onto another file with same content. If metadata is stored in changeset, this does not
82 82 produce a new filelog entry. The changeset's "files" entry should still list the file.
83 83 $ newrepo
84 84 $ echo x > x
85 85 $ echo x > x2
86 86 $ hg ci -Aqm 'add x and x2 with same content'
87 87 $ hg cp -f x x2
88 88 $ hg ci -m 'copy x onto x2'
89 89 $ hg l
90 90 @ 1 copy x onto x2
91 91 | x2
92 92 o 0 add x and x2 with same content
93 93 x x2
94 94 $ hg debugp1copies -r 1
95 95 x -> x2
96 96 Incorrectly doesn't show the rename
97 97 $ hg debugpathcopies 0 1
98 98
99 99 Copy a file, then delete destination, then copy again. This does not create a new filelog entry.
100 100 $ newrepo
101 101 $ echo x > x
102 102 $ hg ci -Aqm 'add x'
103 103 $ hg cp x y
104 104 $ hg ci -m 'copy x to y'
105 105 $ hg rm y
106 106 $ hg ci -m 'remove y'
107 107 $ hg cp -f x y
108 108 $ hg ci -m 'copy x onto y (again)'
109 109 $ hg l
110 110 @ 3 copy x onto y (again)
111 111 | y
112 112 o 2 remove y
113 113 | y
114 114 o 1 copy x to y
115 115 | y
116 116 o 0 add x
117 117 x
118 118 $ hg debugp1copies -r 3
119 119 x -> y
120 120 $ hg debugpathcopies 0 3
121 121 x -> y
122 122
123 123 Rename file in a loop: x->y->z->x
124 124 $ newrepo
125 125 $ echo x > x
126 126 $ hg ci -Aqm 'add x'
127 127 $ hg mv x y
128 128 $ hg debugp1copies
129 129 x -> y
130 130 $ hg debugp2copies
131 131 $ hg ci -m 'rename x to y'
132 132 $ hg mv y z
133 133 $ hg ci -m 'rename y to z'
134 134 $ hg mv z x
135 135 $ hg ci -m 'rename z to x'
136 136 $ hg l
137 137 @ 3 rename z to x
138 138 | x z
139 139 o 2 rename y to z
140 140 | y z
141 141 o 1 rename x to y
142 142 | x y
143 143 o 0 add x
144 144 x
145 145 $ hg debugpathcopies 0 3
146 146
147 147 Copy x to y, then remove y, then add back y. With copy metadata in the changeset, this could easily
148 148 end up reporting y as copied from x (if we don't unmark it as a copy when it's removed).
149 149 $ newrepo
150 150 $ echo x > x
151 151 $ hg ci -Aqm 'add x'
152 152 $ hg mv x y
153 153 $ hg ci -m 'rename x to y'
154 154 $ hg rm y
155 155 $ hg ci -qm 'remove y'
156 156 $ echo x > y
157 157 $ hg ci -Aqm 'add back y'
158 158 $ hg l
159 159 @ 3 add back y
160 160 | y
161 161 o 2 remove y
162 162 | y
163 163 o 1 rename x to y
164 164 | x y
165 165 o 0 add x
166 166 x
167 167 $ hg debugp1copies -r 3
168 168 $ hg debugpathcopies 0 3
169 169
170 170 Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy metadata in the
171 171 changeset, the two copies here will have the same filelog entry, so ctx['z'].introrev() might point
172 172 to the first commit that added the file. We should still report the copy as being from x2.
173 173 $ newrepo
174 174 $ echo x > x
175 175 $ echo x > x2
176 176 $ hg ci -Aqm 'add x and x2 with same content'
177 177 $ hg cp x z
178 178 $ hg ci -qm 'copy x to z'
179 179 $ hg rm z
180 180 $ hg ci -m 'remove z'
181 181 $ hg cp x2 z
182 182 $ hg ci -m 'copy x2 to z'
183 183 $ hg l
184 184 @ 3 copy x2 to z
185 185 | z
186 186 o 2 remove z
187 187 | z
188 188 o 1 copy x to z
189 189 | z
190 190 o 0 add x and x2 with same content
191 191 x x2
192 192 $ hg debugp1copies -r 3
193 193 x2 -> z
194 194 $ hg debugpathcopies 0 3
195 195 x2 -> z
196 196
197 197 Create x and y, then rename them both to the same name, but on different sides of a fork
198 198 $ newrepo
199 199 $ echo x > x
200 200 $ echo y > y
201 201 $ hg ci -Aqm 'add x and y'
202 202 $ hg mv x z
203 203 $ hg ci -qm 'rename x to z'
204 204 $ hg co -q 0
205 205 $ hg mv y z
206 206 $ hg ci -qm 'rename y to z'
207 207 $ hg l
208 208 @ 2 rename y to z
209 209 | y z
210 210 | o 1 rename x to z
211 211 |/ x z
212 212 o 0 add x and y
213 213 x y
214 214 $ hg debugpathcopies 1 2
215 215 z -> x
216 216 y -> z
217 217
218 218 Fork renames x to y on one side and removes x on the other
219 219 $ newrepo
220 220 $ echo x > x
221 221 $ hg ci -Aqm 'add x'
222 222 $ hg mv x y
223 223 $ hg ci -m 'rename x to y'
224 224 $ hg co -q 0
225 225 $ hg rm x
226 226 $ hg ci -m 'remove x'
227 227 created new head
228 228 $ hg l
229 229 @ 2 remove x
230 230 | x
231 231 | o 1 rename x to y
232 232 |/ x y
233 233 o 0 add x
234 234 x
235 235 $ hg debugpathcopies 1 2
236 236
237 237 Copies via null revision (there shouldn't be any)
238 238 $ newrepo
239 239 $ echo x > x
240 240 $ hg ci -Aqm 'add x'
241 241 $ hg cp x y
242 242 $ hg ci -m 'copy x to y'
243 243 $ hg co -q null
244 244 $ echo x > x
245 245 $ hg ci -Aqm 'add x (again)'
246 246 $ hg l
247 247 @ 2 add x (again)
248 248 x
249 249 o 1 copy x to y
250 250 | y
251 251 o 0 add x
252 252 x
253 253 $ hg debugpathcopies 1 2
254 254 $ hg debugpathcopies 2 1
255 255
256 256 Merge rename from other branch
257 257 $ newrepo
258 258 $ echo x > x
259 259 $ hg ci -Aqm 'add x'
260 260 $ hg mv x y
261 261 $ hg ci -m 'rename x to y'
262 262 $ hg co -q 0
263 263 $ echo z > z
264 264 $ hg ci -Aqm 'add z'
265 265 $ hg merge -q 1
266 266 $ hg debugp1copies
267 267 $ hg debugp2copies
268 268 $ hg ci -m 'merge rename from p2'
269 269 $ hg l
270 270 @ 3 merge rename from p2
271 271 |\ x
272 272 | o 2 add z
273 273 | | z
274 274 o | 1 rename x to y
275 275 |/ x y
276 276 o 0 add x
277 277 x
278 278 Perhaps we should indicate the rename here, but `hg status` is documented to be weird during
279 279 merges, so...
280 280 $ hg debugp1copies -r 3
281 281 $ hg debugp2copies -r 3
282 282 $ hg debugpathcopies 0 3
283 283 x -> y
284 284 $ hg debugpathcopies 1 2
285 285 y -> x
286 286 $ hg debugpathcopies 1 3
287 287 $ hg debugpathcopies 2 3
288 288 x -> y
289 289
290 290 Copy file from either side in a merge
291 291 $ newrepo
292 292 $ echo x > x
293 293 $ hg ci -Aqm 'add x'
294 294 $ hg co -q null
295 295 $ echo y > y
296 296 $ hg ci -Aqm 'add y'
297 297 $ hg merge -q 0
298 298 $ hg cp y z
299 299 $ hg debugp1copies
300 300 y -> z
301 301 $ hg debugp2copies
302 302 $ hg ci -m 'copy file from p1 in merge'
303 303 $ hg co -q 1
304 304 $ hg merge -q 0
305 305 $ hg cp x z
306 306 $ hg debugp1copies
307 307 $ hg debugp2copies
308 308 x -> z
309 309 $ hg ci -qm 'copy file from p2 in merge'
310 310 $ hg l
311 311 @ 3 copy file from p2 in merge
312 312 |\ z
313 313 +---o 2 copy file from p1 in merge
314 314 | |/ z
315 315 | o 1 add y
316 316 | y
317 317 o 0 add x
318 318 x
319 319 $ hg debugp1copies -r 2
320 320 y -> z
321 321 $ hg debugp2copies -r 2
322 322 $ hg debugpathcopies 1 2
323 323 y -> z
324 324 $ hg debugpathcopies 0 2
325 325 $ hg debugp1copies -r 3
326 326 $ hg debugp2copies -r 3
327 327 x -> z
328 328 $ hg debugpathcopies 1 3
329 329 $ hg debugpathcopies 0 3
330 330 x -> z
331 331
332 332 Copy file that exists on both sides of the merge, same content on both sides
333 333 $ newrepo
334 334 $ echo x > x
335 335 $ hg ci -Aqm 'add x on branch 1'
336 336 $ hg co -q null
337 337 $ echo x > x
338 338 $ hg ci -Aqm 'add x on branch 2'
339 339 $ hg merge -q 0
340 340 $ hg cp x z
341 341 $ hg debugp1copies
342 342 x -> z
343 343 $ hg debugp2copies
344 344 $ hg ci -qm 'merge'
345 345 $ hg l
346 346 @ 2 merge
347 347 |\ z
348 348 | o 1 add x on branch 2
349 349 | x
350 350 o 0 add x on branch 1
351 351 x
352 352 $ hg debugp1copies -r 2
353 353 x -> z
354 354 $ hg debugp2copies -r 2
355 355 It's a little weird that it shows up on both sides
356 356 $ hg debugpathcopies 1 2
357 357 x -> z
358 358 $ hg debugpathcopies 0 2
359 359 x -> z (filelog !)
360 360
361 361 Copy file that exists on both sides of the merge, different content
362 362 $ newrepo
363 363 $ echo branch1 > x
364 364 $ hg ci -Aqm 'add x on branch 1'
365 365 $ hg co -q null
366 366 $ echo branch2 > x
367 367 $ hg ci -Aqm 'add x on branch 2'
368 368 $ hg merge -q 0
369 369 warning: conflicts while merging x! (edit, then use 'hg resolve --mark')
370 370 [1]
371 371 $ echo resolved > x
372 372 $ hg resolve -m x
373 373 (no more unresolved files)
374 374 $ hg cp x z
375 375 $ hg debugp1copies
376 376 x -> z
377 377 $ hg debugp2copies
378 378 $ hg ci -qm 'merge'
379 379 $ hg l
380 380 @ 2 merge
381 381 |\ x z
382 382 | o 1 add x on branch 2
383 383 | x
384 384 o 0 add x on branch 1
385 385 x
386 386 $ hg debugp1copies -r 2
387 387 x -> z (changeset !)
388 388 $ hg debugp2copies -r 2
389 389 x -> z (no-changeset !)
390 390 $ hg debugpathcopies 1 2
391 391 x -> z (changeset !)
392 392 $ hg debugpathcopies 0 2
393 393 x -> z (no-changeset !)
394 394
395 395 Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent
396 396 of the merge to the merge should include the copy from the other side.
397 397 $ newrepo
398 398 $ echo x > x
399 399 $ hg ci -Aqm 'add x'
400 400 $ hg cp x y
401 401 $ hg ci -qm 'copy x to y'
402 402 $ hg co -q 0
403 403 $ hg cp x z
404 404 $ hg ci -qm 'copy x to z'
405 405 $ hg merge -q 1
406 406 $ hg ci -m 'merge copy x->y and copy x->z'
407 407 $ hg l
408 408 @ 3 merge copy x->y and copy x->z
409 409 |\
410 410 | o 2 copy x to z
411 411 | | z
412 412 o | 1 copy x to y
413 413 |/ y
414 414 o 0 add x
415 415 x
416 416 $ hg debugp1copies -r 3
417 417 $ hg debugp2copies -r 3
418 418 $ hg debugpathcopies 2 3
419 419 x -> y
420 420 $ hg debugpathcopies 1 3
421 421 x -> z
422 422
423 423 Copy x to y on one side of merge, create y and rename to z on the other side. Pathcopies from the
424 424 first side should not include the y->z rename since y didn't exist in the merge base.
425 425 $ newrepo
426 426 $ echo x > x
427 427 $ hg ci -Aqm 'add x'
428 428 $ hg cp x y
429 429 $ hg ci -qm 'copy x to y'
430 430 $ hg co -q 0
431 431 $ echo y > y
432 432 $ hg ci -Aqm 'add y'
433 433 $ hg mv y z
434 434 $ hg ci -m 'rename y to z'
435 435 $ hg merge -q 1
436 436 $ hg ci -m 'merge'
437 437 $ hg l
438 438 @ 4 merge
439 439 |\
440 440 | o 3 rename y to z
441 441 | | y z
442 442 | o 2 add y
443 443 | | y
444 444 o | 1 copy x to y
445 445 |/ y
446 446 o 0 add x
447 447 x
448 448 $ hg debugp1copies -r 3
449 449 y -> z
450 450 $ hg debugp2copies -r 3
451 451 $ hg debugpathcopies 2 3
452 452 y -> z
453 453 $ hg debugpathcopies 1 3
454 454
455 455 Create x and y, then rename x to z on one side of merge, and rename y to z and modify z on the
456 456 other side.
457 457 $ newrepo
458 458 $ echo x > x
459 459 $ echo y > y
460 460 $ hg ci -Aqm 'add x and y'
461 461 $ hg mv x z
462 462 $ hg ci -qm 'rename x to z'
463 463 $ hg co -q 0
464 464 $ hg mv y z
465 465 $ hg ci -qm 'rename y to z'
466 466 $ echo z >> z
467 467 $ hg ci -m 'modify z'
468 468 $ hg merge -q 1
469 469 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
470 470 [1]
471 471 $ echo z > z
472 472 $ hg resolve -qm z
473 473 $ hg ci -m 'merge 1 into 3'
474 474 Try merging the other direction too
475 475 $ hg co -q 1
476 476 $ hg merge -q 3
477 477 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
478 478 [1]
479 479 $ echo z > z
480 480 $ hg resolve -qm z
481 481 $ hg ci -m 'merge 3 into 1'
482 482 created new head
483 483 $ hg l
484 484 @ 5 merge 3 into 1
485 485 |\ y z
486 486 +---o 4 merge 1 into 3
487 487 | |/ x z
488 488 | o 3 modify z
489 489 | | z
490 490 | o 2 rename y to z
491 491 | | y z
492 492 o | 1 rename x to z
493 493 |/ x z
494 494 o 0 add x and y
495 495 x y
496 496 $ hg debugpathcopies 1 4
497 497 $ hg debugpathcopies 2 4
498 498 $ hg debugpathcopies 0 4
499 499 x -> z (filelog !)
500 500 y -> z (compatibility !)
501 501 $ hg debugpathcopies 1 5
502 502 $ hg debugpathcopies 2 5
503 503 $ hg debugpathcopies 0 5
504 504 x -> z
505 505
506 506
507 Test for a case in fullcopytracing algorithm where both the merging csets are
508 "dirty"; where a dirty cset means that cset is descendant of merge base. This
509 test reflect that for this particular case this algorithm correctly find the copies:
507 Test for a case in fullcopytracing algorithm where neither of the merging csets
508 is a descendant of the merge base. This test reflects that the algorithm
509 correctly finds the copies:
510 510
511 511 $ cat >> $HGRCPATH << EOF
512 512 > [experimental]
513 513 > evolution.createmarkers=True
514 514 > evolution.allowunstable=True
515 515 > EOF
516 516
517 517 $ newrepo
518 518 $ echo a > a
519 519 $ hg add a
520 520 $ hg ci -m "added a"
521 521 $ echo b > b
522 522 $ hg add b
523 523 $ hg ci -m "added b"
524 524
525 525 $ hg mv b b1
526 526 $ hg ci -m "rename b to b1"
527 527
528 528 $ hg up ".^"
529 529 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
530 530 $ echo d > d
531 531 $ hg add d
532 532 $ hg ci -m "added d"
533 533 created new head
534 534
535 535 $ echo baba >> b
536 536 $ hg ci --amend -m "added d, modified b"
537 537
538 538 $ hg l --hidden
539 539 @ 4 added d, modified b
540 540 | b d
541 541 | x 3 added d
542 542 |/ d
543 543 | o 2 rename b to b1
544 544 |/ b b1
545 545 o 1 added b
546 546 | b
547 547 o 0 added a
548 548 a
549 549
550 550 Grafting revision 4 on top of revision 2, showing that it respect the rename:
551 551
552 552 $ hg up 2 -q
553 553 $ hg graft -r 4 --base 3 --hidden
554 554 grafting 4:af28412ec03c "added d, modified b" (tip)
555 555 merging b1 and b to b1
556 556
557 557 $ hg l -l1 -p
558 558 @ 5 added d, modified b
559 559 | b1
560 560 ~ diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1 (no-changeset !)
561 561 ~ diff -r f5474f5023a8 -r ef7c02d69f3d b1 (changeset !)
562 562 --- a/b1 Thu Jan 01 00:00:00 1970 +0000
563 563 +++ b/b1 Thu Jan 01 00:00:00 1970 +0000
564 564 @@ -1,1 +1,2 @@
565 565 b
566 566 +baba
567 567
568 Test to make sure that fullcopytracing algorithm don't fail when both the merging csets are dirty
569 (a dirty cset is one who is not the descendant of merge base)
568 Test to make sure that fullcopytracing algorithm doesn't fail when neither of the
569 merging csets is a descendant of the base.
570 570 -------------------------------------------------------------------------------------------------
571 571
572 572 $ newrepo
573 573 $ echo a > a
574 574 $ hg add a
575 575 $ hg ci -m "added a"
576 576 $ echo b > b
577 577 $ hg add b
578 578 $ hg ci -m "added b"
579 579
580 580 $ echo foobar > willconflict
581 581 $ hg add willconflict
582 582 $ hg ci -m "added willconflict"
583 583 $ echo c > c
584 584 $ hg add c
585 585 $ hg ci -m "added c"
586 586
587 587 $ hg l
588 588 @ 3 added c
589 589 | c
590 590 o 2 added willconflict
591 591 | willconflict
592 592 o 1 added b
593 593 | b
594 594 o 0 added a
595 595 a
596 596
597 597 $ hg up ".^^"
598 598 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
599 599 $ echo d > d
600 600 $ hg add d
601 601 $ hg ci -m "added d"
602 602 created new head
603 603
604 604 $ echo barfoo > willconflict
605 605 $ hg add willconflict
606 606 $ hg ci --amend -m "added willconflict and d"
607 607
608 608 $ hg l
609 609 @ 5 added willconflict and d
610 610 | d willconflict
611 611 | o 3 added c
612 612 | | c
613 613 | o 2 added willconflict
614 614 |/ willconflict
615 615 o 1 added b
616 616 | b
617 617 o 0 added a
618 618 a
619 619
620 620 $ hg rebase -r . -d 2 -t :other
621 621 rebasing 5:5018b1509e94 "added willconflict and d" (tip)
622 622
623 623 $ hg up 3 -q
624 624 $ hg l --hidden
625 625 o 6 added willconflict and d
626 626 | d willconflict
627 627 | x 5 added willconflict and d
628 628 | | d willconflict
629 629 | | x 4 added d
630 630 | |/ d
631 631 +---@ 3 added c
632 632 | | c
633 633 o | 2 added willconflict
634 634 |/ willconflict
635 635 o 1 added b
636 636 | b
637 637 o 0 added a
638 638 a
639 639
640 Now if we trigger a merge between cset revision 3 and 6 using base revision 4, in this case
641 both the merging csets will be dirty as no one is descendent of base revision:
640 Now if we trigger a merge between revision 3 and 6 using base revision 4,
641 neither of the merging csets will be a descendant of the base revision:
642 642
643 643 $ hg graft -r 6 --base 4 --hidden -t :other
644 644 grafting 6:99802e4f1e46 "added willconflict and d" (tip)
General Comments 0
You need to be logged in to leave comments. Login now