comparison tests/test-topic.t @ 3037:5c8d5f980f49

tests: add a new test for testing changing or clearing topics test-topic.t is getting bigger and bigger. This patch introduces a new test which includes test for clearing and changing topics. Since the tests are moved to a new file, this patch, removes those tests from test-topic.t also.
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 05 Oct 2017 18:13:52 +0530
parents b220e2f5ebd5
children f43a310c4338
comparison
equal deleted inserted replaced
3036:60896df503ba 3037:5c8d5f980f49
500 $ hg topics --clear 500 $ hg topics --clear
501 clearing empty topic "query" 501 clearing empty topic "query"
502 $ hg topics 502 $ hg topics
503 fran 503 fran
504 504
505 --clear when we don't have an active topic isn't an error:
506
507 $ hg topics --clear
508
509 Topic revset 505 Topic revset
510 $ hg log -r 'topic()' -G 506 $ hg log -r 'topic()' -G
511 o changeset: 9:0469d521db49 507 o changeset: 9:0469d521db49
512 | tag: tip 508 | tag: tip
513 | topic: fran 509 | topic: fran
626 | parent: 3:a53952faf762 622 | parent: 3:a53952faf762
627 | user: test 623 | user: test
628 | date: Thu Jan 01 00:00:00 1970 +0000 624 | date: Thu Jan 01 00:00:00 1970 +0000
629 | summary: start on fran 625 | summary: start on fran
630 | 626 |
627
631 $ hg topics 628 $ hg topics
632 fran 629 fran
633 Changing topic fails if we don't give a topic
634 $ hg topic --rev 9
635 abort: changing topic requires a topic name or --clear
636 [255]
637
638 Can't change topic of a public change
639 $ hg topic --rev 1:: --clear
640 abort: can't change topic of a public change
641 [255]
642
643 Can clear topics
644 $ hg topic --rev 9 --clear
645 changed topic on 1 changes
646 $ hg log -Gr 'draft() and not obsolete()'
647 o changeset: 11:0beca5ab56c3
648 | tag: tip
649 | parent: 3:a53952faf762
650 | user: test
651 | date: Thu Jan 01 00:00:00 1970 +0000
652 | summary: start on fran
653 |
654 | @ changeset: 10:4073470c35e1
655 | | user: test
656 | | date: Thu Jan 01 00:00:00 1970 +0000
657 | | instability: orphan
658 | | summary: fran?
659 | |
660
661 Normally you'd do this with evolve, but we'll use rebase to avoid
662 bonus deps in the testsuite.
663
664 $ hg rebase -d tip -s .
665 rebasing 10:4073470c35e1 "fran?"
666
667 Can add a topic to an existing change
668 $ hg topic
669 $ hg sum
670 parent: 12:18b70b8de1f0 tip
671 fran?
672 branch: default
673 commit: (clean)
674 update: 5 new changesets, 2 branch heads (merge)
675 phases: 2 draft
676 $ hg topic --rev 11 wat
677 changed topic on 1 changes
678 $ hg log -r .
679 changeset: 12:18b70b8de1f0
680 user: test
681 date: Thu Jan 01 00:00:00 1970 +0000
682 instability: orphan
683 summary: fran?
684
685 $ hg sum
686 parent: 12:18b70b8de1f0 (orphan)
687 fran?
688 branch: default
689 commit: (clean)
690 update: 5 new changesets, 2 branch heads (merge)
691 phases: 3 draft
692 orphan: 1 changesets
693 $ hg topic
694 wat
695 $ hg log -Gr 'draft() and not obsolete()'
696 o changeset: 13:686a642006db
697 | tag: tip
698 | topic: wat
699 | parent: 3:a53952faf762
700 | user: test
701 | date: Thu Jan 01 00:00:00 1970 +0000
702 | summary: start on fran
703 |
704 | @ changeset: 12:18b70b8de1f0
705 | | user: test
706 | | date: Thu Jan 01 00:00:00 1970 +0000
707 | | instability: orphan
708 | | summary: fran?
709 | |
710
711 Normally you'd do this with evolve, but we'll use rebase to avoid
712 bonus deps in the testsuite.
713
714 $ hg topic
715 wat
716 $ hg rebase -d tip -s .
717 rebasing 12:18b70b8de1f0 "fran?"
718 switching to topic wat
719 $ hg topic
720 wat
721
722 $ hg log -Gr 'draft()'
723 @ changeset: 14:45358f7a5892
724 | tag: tip
725 | user: test
726 | date: Thu Jan 01 00:00:00 1970 +0000
727 | summary: fran?
728 |
729 o changeset: 13:686a642006db
730 | topic: wat
731 | parent: 3:a53952faf762
732 | user: test
733 | date: Thu Jan 01 00:00:00 1970 +0000
734 | summary: start on fran
735 |
736
737 Amend a topic
738
739 $ hg topic watwat
740 marked working directory as topic: watwat
741 $ hg ci --amend
742 active topic 'watwat' grew its first changeset
743 $ hg log -Gr 'draft()'
744 @ changeset: 15:6c40a4c21bbe
745 | tag: tip
746 | topic: watwat
747 | parent: 13:686a642006db
748 | user: test
749 | date: Thu Jan 01 00:00:00 1970 +0000
750 | summary: fran?
751 |
752 o changeset: 13:686a642006db
753 | topic: wat
754 | parent: 3:a53952faf762
755 | user: test
756 | date: Thu Jan 01 00:00:00 1970 +0000
757 | summary: start on fran
758 |
759
760 Clear and amend:
761
762 $ hg topic --clear
763 $ hg ci --amend
764 $ hg log -r .
765 changeset: 16:0f9cd5070654
766 tag: tip
767 parent: 13:686a642006db
768 user: test
769 date: Thu Jan 01 00:00:00 1970 +0000
770 summary: fran?
771
772 Reading the same topic with topic --rev should work:
773 $ hg topic --rev . watwat
774 switching to topic watwat
775 changed topic on 1 changes
776
777 Testing issue5441
778 $ hg co 17
779 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
780 $ hg log -Gr 'draft()'
781 @ changeset: 17:980a0f608481
782 | tag: tip
783 | topic: watwat
784 | parent: 13:686a642006db
785 | user: test
786 | date: Thu Jan 01 00:00:00 1970 +0000
787 | summary: fran?
788 |
789 o changeset: 13:686a642006db
790 | topic: wat
791 | parent: 3:a53952faf762
792 | user: test
793 | date: Thu Jan 01 00:00:00 1970 +0000
794 | summary: start on fran
795 |
796
797 Using the current flag
798
799 $ hg topic changewat
800 $ hg topics --rev '13::17' --current
801 active topic 'changewat' grew its 2 first changesets
802 changed topic on 2 changes
803
804 $ hg log -Gr 'draft()'
805 @ changeset: 19:56c83be6105f
806 | tag: tip
807 | topic: changewat
808 | user: test
809 | date: Thu Jan 01 00:00:00 1970 +0000
810 | summary: fran?
811 |
812 o changeset: 18:ceba5be9d56f
813 | topic: changewat
814 | parent: 3:a53952faf762
815 | user: test
816 | date: Thu Jan 01 00:00:00 1970 +0000
817 | summary: start on fran
818 |
819
820 Case with branching:
821
822 $ hg up changewat
823 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
824 $ hg up t1
825 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
826 $ echo gamma >> gamma
827 $ hg ci -m gamma
828
829 $ hg log -Gr 'draft()'
830 @ changeset: 20:0d3d805542b4
831 | tag: tip
832 | topic: changewat
833 | parent: 18:ceba5be9d56f
834 | user: test
835 | date: Thu Jan 01 00:00:00 1970 +0000
836 | summary: gamma
837 |
838 | o changeset: 19:56c83be6105f
839 |/ topic: changewat
840 | user: test
841 | date: Thu Jan 01 00:00:00 1970 +0000
842 | summary: fran?
843 |
844 o changeset: 18:ceba5be9d56f
845 | topic: changewat
846 | parent: 3:a53952faf762
847 | user: test
848 | date: Thu Jan 01 00:00:00 1970 +0000
849 | summary: start on fran
850 |
851
852 $ hg topics --rev 't1::' changewut
853 switching to topic changewut
854 active topic 'changewat' is now empty
855 changed topic on 3 changes
856
857 $ hg log -Gr 'draft()'
858 @ changeset: 23:729ed5717393
859 | tag: tip
860 | topic: changewut
861 | parent: 21:62e49f09f883
862 | user: test
863 | date: Thu Jan 01 00:00:00 1970 +0000
864 | summary: gamma
865 |
866 | o changeset: 22:369c6e2e5474
867 |/ topic: changewut
868 | user: test
869 | date: Thu Jan 01 00:00:00 1970 +0000
870 | summary: fran?
871 |
872 o changeset: 21:62e49f09f883
873 | topic: changewut
874 | parent: 3:a53952faf762
875 | user: test
876 | date: Thu Jan 01 00:00:00 1970 +0000
877 | summary: start on fran
878 |
879 630
880 Testing for updating to t0 631 Testing for updating to t0
881 ========================== 632 ==========================
882 633
634 $ hg up fran
635 switching to topic fran
636 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
883 $ hg stack 637 $ hg stack
884 ### topic: changewut (2 heads) 638 ### topic: fran
885 ### target: default (branch), 5 behind 639 ### target: default (branch), ambigious rebase destination - branch 'default' has 2 heads
886 t3: fran? 640 t1@ start on fran (current)
887 t1^ start on fran (base) 641 t0^ Add file delta (base)
888 t2@ gamma (current) 642
643 $ hg up t0
644 preserving the current topic 'fran'
645 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
646
647 $ hg topic
648 * fran
649 $ hg stack
650 ### topic: fran
651 ### target: default (branch), ambigious rebase destination - branch 'default' has 2 heads
889 t1: start on fran 652 t1: start on fran
890 t0^ Add file delta (base) 653 t0^ Add file delta (base)
891 654
892 $ hg up t0
893 preserving the current topic 'changewut'
894 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
895
896 $ hg topic
897 * changewut
898 $ hg stack
899 ### topic: changewut (2 heads)
900 ### target: default (branch), 5 behind
901 t3: fran?
902 t1^ start on fran (base)
903 t2: gamma
904 t1: start on fran
905 t0^ Add file delta (base)
906
907 $ hg topics --age 655 $ hg topics --age
908 * changewut (1970-01-01 by test) 656 * fran (1970-01-01 by test)
909 657
910 $ cd .. 658 $ cd ..
911 659
912 Testing the new config knob to forbid untopiced commit 660 Testing the new config knob to forbid untopiced commit
913 ====================================================== 661 ======================================================