Mercurial > evolve
comparison tests/test-evolve-orphan-merge.t @ 3573:d53277cdc1e7
evolve: handle stabilization of merge changeset with both parents obsoleted
This patch adds logic to stabilize an orphan merge changeset having both parents
obsoleted.
The logic tries to first stabilize the merge changeset on successor of second
parent and then stabilize the new changeset formed on the successor of first
parent. We are stabilizing on second parent first and then to second parent to
preserve the first parent's successor as first parent of the merge changeset.
Conflicts can occcur and we can loose processing information, therefore we store
a variable in statefile `orphanmerge` which represents whether we are processing
a merge changeset with both parents obsoleted.
Thanks to Pierre-Yves David for suggesting this way and helping to understand
the correctness of this.
More rigourous test cases for this will be added in next patch.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 18 Mar 2018 17:29:32 +0530 |
parents | 34330381b76b |
children | d5adce52cef4 f6979d64b9fb |
comparison
equal
deleted
inserted
replaced
3572:7934e9751d69 | 3573:d53277cdc1e7 |
---|---|
415 o 0:8fa14d15e168 added hgignore | 415 o 0:8fa14d15e168 added hgignore |
416 () draft | 416 () draft |
417 | 417 |
418 XXX: We should handle this case too | 418 XXX: We should handle this case too |
419 $ hg evolve --all | 419 $ hg evolve --all |
420 warning: no support for evolving merge changesets with two obsolete parents yet | 420 move:[23] merged l and x |
421 (Redo the merge (7b78a9784f3e) and use `hg prune <old> --succ <new>` to obsolete the old one) | 421 atop:[25] added x |
422 move:[26] merged l and x | |
423 atop:[24] added l | |
424 working directory is now at adb665a78e08 | |
425 | |
426 $ hg glog | |
427 @ 27:adb665a78e08 merged l and x | |
428 |\ () draft | |
429 | o 25:cdf6547da25f added x | |
430 | | () draft | |
431 o | 24:3f371171d767 added l | |
432 |/ () draft | |
433 o 0:8fa14d15e168 added hgignore | |
434 () draft | |
435 | |
436 $ hg exp | |
437 # HG changeset patch | |
438 # User test | |
439 # Date 0 0 | |
440 # Thu Jan 01 00:00:00 1970 +0000 | |
441 # Node ID adb665a78e08b962cff415301058d782086c0f33 | |
442 # Parent 3f371171d767ef79cf85d156cf46d4035960fcf0 | |
443 # Parent cdf6547da25f1ca5d01102302ad713f444547b48 | |
444 merged l and x | |
445 | |
446 diff -r 3f371171d767 -r adb665a78e08 x | |
447 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
448 +++ b/x Thu Jan 01 00:00:00 1970 +0000 | |
449 @@ -0,0 +1,1 @@ | |
450 +bar | |
451 | |
452 $ hg parents | |
453 changeset: 27:adb665a78e08 | |
454 tag: tip | |
455 parent: 24:3f371171d767 | |
456 parent: 25:cdf6547da25f | |
457 user: test | |
458 date: Thu Jan 01 00:00:00 1970 +0000 | |
459 summary: merged l and x | |
460 | |
422 | 461 |
423 5) When one of the merge parent is pruned without a successor | 462 5) When one of the merge parent is pruned without a successor |
424 ------------------------------------------------------------- | 463 ------------------------------------------------------------- |
425 | 464 |
426 $ hg prune -r 7b78a9784 | |
427 1 changesets pruned | |
428 | |
429 $ hg merge | |
430 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
431 (branch merge, don't forget to commit) | |
432 $ hg ci -m "merged l and x" | |
433 $ hg glog | |
434 @ 26:47e57ebc80aa merged l and x | |
435 |\ () draft | |
436 | o 25:cdf6547da25f added x | |
437 | | () draft | |
438 o | 24:3f371171d767 added l | |
439 |/ () draft | |
440 o 0:8fa14d15e168 added hgignore | |
441 () draft | |
442 | |
443 $ hg prune -r cdf6547da25f | 465 $ hg prune -r cdf6547da25f |
444 1 changesets pruned | 466 1 changesets pruned |
445 1 new orphan changesets | 467 1 new orphan changesets |
446 $ hg glog | 468 $ hg glog |
447 @ 26:47e57ebc80aa merged l and x | 469 @ 27:adb665a78e08 merged l and x |
448 |\ () draft | 470 |\ () draft |
449 | x 25:cdf6547da25f added x | 471 | x 25:cdf6547da25f added x |
450 | | () draft | 472 | | () draft |
451 o | 24:3f371171d767 added l | 473 o | 24:3f371171d767 added l |
452 |/ () draft | 474 |/ () draft |
453 o 0:8fa14d15e168 added hgignore | 475 o 0:8fa14d15e168 added hgignore |
454 () draft | 476 () draft |
455 | 477 |
456 $ hg evolve --rev . | 478 $ hg evolve --rev . |
457 move:[26] merged l and x | 479 move:[27] merged l and x |
458 atop:[0] added hgignore | 480 atop:[0] added hgignore |
459 working directory is now at c117a030135c | 481 working directory is now at fb8fe870ae7d |
460 | 482 |
461 $ hg glog | 483 $ hg glog |
462 @ 27:c117a030135c merged l and x | 484 @ 28:fb8fe870ae7d merged l and x |
463 |\ () draft | 485 |\ () draft |
464 | o 24:3f371171d767 added l | 486 | o 24:3f371171d767 added l |
465 |/ () draft | 487 |/ () draft |
466 o 0:8fa14d15e168 added hgignore | 488 o 0:8fa14d15e168 added hgignore |
467 () draft | 489 () draft |
469 6) When one parent is pruned without successor and the other parent of merge is | 491 6) When one parent is pruned without successor and the other parent of merge is |
470 the parent of the pruned commit | 492 the parent of the pruned commit |
471 -------------------------------------------------------------------------------- | 493 -------------------------------------------------------------------------------- |
472 | 494 |
473 $ hg glog | 495 $ hg glog |
474 @ 27:c117a030135c merged l and x | 496 @ 28:fb8fe870ae7d merged l and x |
475 |\ () draft | 497 |\ () draft |
476 | o 24:3f371171d767 added l | 498 | o 24:3f371171d767 added l |
477 |/ () draft | 499 |/ () draft |
478 o 0:8fa14d15e168 added hgignore | 500 o 0:8fa14d15e168 added hgignore |
479 () draft | 501 () draft |
481 $ hg prune -r 3f371171d767 | 503 $ hg prune -r 3f371171d767 |
482 1 changesets pruned | 504 1 changesets pruned |
483 1 new orphan changesets | 505 1 new orphan changesets |
484 | 506 |
485 $ hg glog | 507 $ hg glog |
486 @ 27:c117a030135c merged l and x | 508 @ 28:fb8fe870ae7d merged l and x |
487 |\ () draft | 509 |\ () draft |
488 | x 24:3f371171d767 added l | 510 | x 24:3f371171d767 added l |
489 |/ () draft | 511 |/ () draft |
490 o 0:8fa14d15e168 added hgignore | 512 o 0:8fa14d15e168 added hgignore |
491 () draft | 513 () draft |
509 that branch and they prune all their changeset, which will result in this | 531 that branch and they prune all their changeset, which will result in this |
510 case where merge commit becomes orphan with its ancestors pruned up until a | 532 case where merge commit becomes orphan with its ancestors pruned up until a |
511 point where the other parent of merge is the first non-pruned ancestor. | 533 point where the other parent of merge is the first non-pruned ancestor. |
512 | 534 |
513 $ hg evolve -r . | 535 $ hg evolve -r . |
514 move:[27] merged l and x | 536 move:[28] merged l and x |
515 atop:[0] added hgignore | 537 atop:[0] added hgignore |
516 working directory is now at 57b29ecd607c | 538 working directory is now at b61ba77b924a |
517 | 539 |
518 $ hg glog | 540 $ hg glog |
519 @ 28:57b29ecd607c merged l and x | 541 @ 29:b61ba77b924a merged l and x |
520 | () draft | 542 | () draft |
521 o 0:8fa14d15e168 added hgignore | 543 o 0:8fa14d15e168 added hgignore |
522 () draft | 544 () draft |
523 | 545 |
524 7) When one parent is pruned without successor and has no parent | 546 7) When one parent is pruned without successor and has no parent |
528 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | 550 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
529 working directory now at 8fa14d15e168 | 551 working directory now at 8fa14d15e168 |
530 1 changesets pruned | 552 1 changesets pruned |
531 $ hg up null | 553 $ hg up null |
532 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | 554 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
533 $ hg glog | |
534 o 0:8fa14d15e168 added hgignore | |
535 () draft | |
536 | 555 |
537 $ echo foo > foo | 556 $ echo foo > foo |
538 $ hg add foo | 557 $ hg add foo |
539 $ hg ci -m "added foo" | 558 $ hg ci -m "added foo" |
540 created new head | 559 created new head |
541 $ hg glog | |
542 @ 29:f3ba8b99bb6f added foo | |
543 () draft | |
544 o 0:8fa14d15e168 added hgignore | |
545 () draft | |
546 | 560 |
547 $ hg merge | 561 $ hg merge |
548 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 562 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
549 (branch merge, don't forget to commit) | 563 (branch merge, don't forget to commit) |
550 $ hg ci -m "merge commit" | 564 $ hg ci -m "merge commit" |
565 $ hg glog | |
566 @ 31:32beb84b9dbc merge commit | |
567 |\ () draft | |
568 | o 30:f3ba8b99bb6f added foo | |
569 | () draft | |
570 o 0:8fa14d15e168 added hgignore | |
571 () draft | |
551 | 572 |
552 $ hg prune -r f3ba8b99bb6f | 573 $ hg prune -r f3ba8b99bb6f |
553 1 changesets pruned | 574 1 changesets pruned |
554 1 new orphan changesets | 575 1 new orphan changesets |
555 | 576 |
556 $ hg glog | 577 $ hg glog |
557 @ 30:32beb84b9dbc merge commit | 578 @ 31:32beb84b9dbc merge commit |
558 |\ () draft | 579 |\ () draft |
559 | x 29:f3ba8b99bb6f added foo | 580 | x 30:f3ba8b99bb6f added foo |
560 | () draft | 581 | () draft |
561 o 0:8fa14d15e168 added hgignore | 582 o 0:8fa14d15e168 added hgignore |
562 () draft | 583 () draft |
563 | 584 |
564 The current behavior seems to be the correct behavior in the above case. This is | 585 The current behavior seems to be the correct behavior in the above case. This is |
572 | 593 |
573 becomes redundant as the changeset is pruned without successor and we should | 594 becomes redundant as the changeset is pruned without successor and we should |
574 just remove that chain. | 595 just remove that chain. |
575 | 596 |
576 $ hg evolve -r . | 597 $ hg evolve -r . |
577 move:[30] merge commit | 598 move:[31] merge commit |
578 atop:[-1] | 599 atop:[-1] |
579 working directory is now at d2a03dd8c951 | 600 working directory is now at d2a03dd8c951 |
580 | 601 |
581 $ hg glog | 602 $ hg glog |
582 @ 31:d2a03dd8c951 merge commit | 603 @ 32:d2a03dd8c951 merge commit |
583 | () draft | 604 | () draft |
584 o 0:8fa14d15e168 added hgignore | 605 o 0:8fa14d15e168 added hgignore |
585 () draft | 606 () draft |