comparison tests/test-rewind.t @ 3867:339b05c3e929

rewind: add a test about rewinding top of stack For now this rewind is creating an orphan. We add the test to check the behavior in that case.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 17 Jun 2018 02:22:28 +0200
parents de42d00d6ee2
children 1742254d1190
comparison
equal deleted inserted replaced
3866:de42d00d6ee2 3867:339b05c3e929
638 o changeset: 0:eba9c2249fe7 638 o changeset: 0:eba9c2249fe7
639 user: test 639 user: test
640 date: Thu Jan 01 00:00:00 1970 +0000 640 date: Thu Jan 01 00:00:00 1970 +0000
641 summary: c_ROOT 641 summary: c_ROOT
642 642
643 $ cd ..
644
645 Test rewinding stack
646 ====================
647
648 $ hg clone rewind-testing-base rewind-testing-stack
649 updating to branch default
650 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
651 $ cd rewind-testing-stack
652
653 Rewinding the top of the stack only
654 -----------------------------------
655
656 setup
657 `````
658
659 $ hg up 'desc("c_A0")'
660 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
661 $ echo AA >> A
662 $ hg amend -m 'c_A1'
663 1 new orphan changesets
664 $ hg evolve --all
665 move:[2] c_B0
666 atop:[3] c_A1
667 working directory is now at a65fceb2324a
668 $ hg debugobsolete
669 579f120ba91885449adc92eedf48ef3569742cee d952d1794ff657f5c2a82225d2e6307ed930b32f 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
670 7e594302a05d3769b27be88fc3cdfd39d7498498 a65fceb2324ae1eb1231610193d24a5fa02c7c0e 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
671 $ hg obslog -r 'desc("c_A1")::'
672 @ a65fceb2324a (4) c_B0
673 |
674 | o d952d1794ff6 (3) c_A1
675 | |
676 | x 579f120ba918 (1) c_A0
677 | rewritten(description, content) as d952d1794ff6 using amend by test (Thu Jan 01 00:00:03 1970 +0000)
678 |
679 x 7e594302a05d (2) c_B0
680 rewritten(parent) as a65fceb2324a using evolve by test (Thu Jan 01 00:00:03 1970 +0000)
681
682 $ hg log -G
683 @ changeset: 4:a65fceb2324a
684 | tag: tip
685 | user: test
686 | date: Thu Jan 01 00:00:00 1970 +0000
687 | summary: c_B0
688 |
689 o changeset: 3:d952d1794ff6
690 | parent: 0:eba9c2249fe7
691 | user: test
692 | date: Thu Jan 01 00:00:00 1970 +0000
693 | summary: c_A1
694 |
695 o changeset: 0:eba9c2249fe7
696 user: test
697 date: Thu Jan 01 00:00:00 1970 +0000
698 summary: c_ROOT
699
700
701 Actual rewind
702 `````````````
703
704 $ hg rewind --hidden --to 'min(desc(c_B0))'
705 1 new orphan changesets
706 rewinded to 1 changesets
707 (1 changesets obsoleted)
708 working directory is now at 96622b0702dd
709 $ hg debugobsolete
710 579f120ba91885449adc92eedf48ef3569742cee d952d1794ff657f5c2a82225d2e6307ed930b32f 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
711 7e594302a05d3769b27be88fc3cdfd39d7498498 a65fceb2324ae1eb1231610193d24a5fa02c7c0e 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
712 7e594302a05d3769b27be88fc3cdfd39d7498498 96622b0702dd86e3a702b0235b420da41f072efe 4 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
713 a65fceb2324ae1eb1231610193d24a5fa02c7c0e 96622b0702dd86e3a702b0235b420da41f072efe 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
714 $ hg obslog
715 @ 96622b0702dd (5) c_B0
716 |\
717 | x a65fceb2324a (4) c_B0
718 |/ rewritten(meta, date, parent) as 96622b0702dd using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
719 |
720 x 7e594302a05d (2) c_B0
721 rewritten(meta, date) as 96622b0702dd using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
722 rewritten(parent) as a65fceb2324a using evolve by test (Thu Jan 01 00:00:03 1970 +0000)
723
724 $ hg log -G
725 @ changeset: 5:96622b0702dd
726 | tag: tip
727 | parent: 1:579f120ba918
728 | user: test
729 | date: Thu Jan 01 00:00:03 1970 +0000
730 | instability: orphan
731 | summary: c_B0
732 |
733 | o changeset: 3:d952d1794ff6
734 | | parent: 0:eba9c2249fe7
735 | | user: test
736 | | date: Thu Jan 01 00:00:00 1970 +0000
737 | | summary: c_A1
738 | |
739 x | changeset: 1:579f120ba918
740 |/ user: test
741 | date: Thu Jan 01 00:00:00 1970 +0000
742 | obsolete: rewritten using amend as 3:d952d1794ff6
743 | summary: c_A0
744 |
745 o changeset: 0:eba9c2249fe7
746 user: test
747 date: Thu Jan 01 00:00:00 1970 +0000
748 summary: c_ROOT
749
750
751 cleanup
752 ```````
753
754 $ echo 'default-date = 4 0' >> $HGRCPATH
755 $ hg rewind --hidden --to 'max(precursors(.))'
756 rewinded to 1 changesets
757 (1 changesets obsoleted)
758 working directory is now at 7b1440274cc3
759 $ echo 'default-date = 5 0' >> $HGRCPATH
760 $ hg log -G
761 @ changeset: 6:7b1440274cc3
762 | tag: tip
763 | parent: 3:d952d1794ff6
764 | user: test
765 | date: Thu Jan 01 00:00:04 1970 +0000
766 | summary: c_B0
767 |
768 o changeset: 3:d952d1794ff6
769 | parent: 0:eba9c2249fe7
770 | user: test
771 | date: Thu Jan 01 00:00:00 1970 +0000
772 | summary: c_A1
773 |
774 o changeset: 0:eba9c2249fe7
775 user: test
776 date: Thu Jan 01 00:00:00 1970 +0000
777 summary: c_ROOT
778
779 $ hg debugobsolete
780 579f120ba91885449adc92eedf48ef3569742cee d952d1794ff657f5c2a82225d2e6307ed930b32f 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
781 7e594302a05d3769b27be88fc3cdfd39d7498498 a65fceb2324ae1eb1231610193d24a5fa02c7c0e 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
782 7e594302a05d3769b27be88fc3cdfd39d7498498 96622b0702dd86e3a702b0235b420da41f072efe 4 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
783 a65fceb2324ae1eb1231610193d24a5fa02c7c0e 96622b0702dd86e3a702b0235b420da41f072efe 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
784 a65fceb2324ae1eb1231610193d24a5fa02c7c0e 7b1440274cc3b3f8bfcffc891172a7d2d7e9140c 4 (Thu Jan 01 00:00:04 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
785 96622b0702dd86e3a702b0235b420da41f072efe 7b1440274cc3b3f8bfcffc891172a7d2d7e9140c 0 (Thu Jan 01 00:00:04 1970 +0000) {'ef1': '38', 'operation': 'rewind', 'user': 'test'}
786 $ hg obslog
787 @ 7b1440274cc3 (6) c_B0
788 |\
789 x | 96622b0702dd (5) c_B0
790 |\| rewritten(meta, date, parent) as 7b1440274cc3 using rewind by test (Thu Jan 01 00:00:04 1970 +0000)
791 | |
792 | x a65fceb2324a (4) c_B0
793 |/ rewritten(meta, date) as 7b1440274cc3 using rewind by test (Thu Jan 01 00:00:04 1970 +0000)
794 | rewritten(meta, date, parent) as 96622b0702dd using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
795 |
796 x 7e594302a05d (2) c_B0
797 rewritten(meta, date) as 96622b0702dd using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
798 rewritten(parent) as a65fceb2324a using evolve by test (Thu Jan 01 00:00:03 1970 +0000)
799