comparison tests/test-evolve-public-content-divergent.t @ 4416:b2a8e67b0933

evolve: handle a case in pubic-div when merging results in same as public In public divergence resolution, what we do is: 1) first apply content divergence resolution 2) then phase divergent resolution on resultant node of 1) case While doing case 1 it is possible that result of merging the two csets would have same changes as public one contains. And then processing the case 2 would create an empty commit which is not something we want to do. So this patch catch that same case when merging results in same as public cset and don't create a new node, instead to solve the divergence it just add a obsmarker from "other divergent" to "public divergent" i.e. [other, (public,)] Next patch will add the continue case handling for this same case. This patch also adds the tests for the different cases which are possible for the above mentioned case. There is test for continue case too which is broken in this patch and will be fixed in next patch.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Fri, 22 Feb 2019 01:02:51 +0530
parents 2360a1e050a6
children b86413cfca4a
comparison
equal deleted inserted replaced
4415:29733c2b0fd3 4416:b2a8e67b0933
696 committed as b9082a9e66ce 696 committed as b9082a9e66ce
697 working directory is now at b9082a9e66ce 697 working directory is now at b9082a9e66ce
698 698
699 $ hg evolve -l 699 $ hg evolve -l
700 $ cd .. 700 $ cd ..
701
702
703 Testing the case when "merging results in same as public cset" where:
704 both the csets are on same parent and no conflict in merging.
705 ---------------------------------------------------------------------
706
707 Prepare the repo:
708
709 $ hg init pubdiv5
710 $ cd pubdiv5
711 $ for ch in a b c; do
712 > echo $ch > $ch;
713 > hg ci -Am "added "$ch;
714 > done;
715 adding a
716 adding b
717 adding c
718
719 $ hg up .^
720 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
721 $ echo ch > ch
722 $ hg add ch
723 $ hg ci -m "added ch"
724 created new head
725
726 $ hg up .^
727 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
728 $ echo ch > ch
729 $ hg add ch
730 $ hg ci -m "added c"
731 created new head
732
733 $ hg glog
734 @ 4:f7c1071f1e7c added c
735 | draft
736 |
737 | o 3:90522bccf499 added ch
738 |/ draft
739 |
740 | o 2:155349b645be added c
741 |/ draft
742 |
743 o 1:5f6d8a4bf34a added b
744 | draft
745 |
746 o 0:9092f1db7931 added a
747 draft
748
749
750 $ hg prune 2 -s 3
751 1 changesets pruned
752 $ hg prune 2 -s 4 --hidden
753 1 changesets pruned
754 2 new content-divergent changesets
755 $ hg phase --public -r 4
756
757 $ hg glog
758 @ 4:f7c1071f1e7c added c
759 | public
760 |
761 | * 3:90522bccf499 added ch
762 |/ draft content-divergent
763 |
764 o 1:5f6d8a4bf34a added b
765 | public
766 |
767 o 0:9092f1db7931 added a
768 public
769
770 $ hg evolve --content-divergent --any
771 merge:[4] added c
772 with: [3] added ch
773 base: [2] added c
774 merging "other" content-divergent changeset '90522bccf499'
775 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
776
777 $ hg evolve -l
778
779 $ hg par
780 changeset: 4:f7c1071f1e7c
781 tag: tip
782 parent: 1:5f6d8a4bf34a
783 user: test
784 date: Thu Jan 01 00:00:00 1970 +0000
785 summary: added c
786
787
788 Testing the case when "merging results in same as public cset" where:
789 both the csets are on different parent and no conflict in merging and relocation.
790 ---------------------------------------------------------------------------------
791
792 Prepare the repo:
793
794 $ cd ..
795 $ hg init pubdiv6
796 $ cd pubdiv6
797 $ for ch in a b c d; do
798 > echo $ch > $ch;
799 > hg ci -Am "added "$ch;
800 > done;
801 adding a
802 adding b
803 adding c
804 adding d
805
806 $ hg up 1
807 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
808 $ echo dh > dh
809 $ hg add dh
810 $ hg ci -m "added dh"
811 created new head
812
813 $ hg up 2
814 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
815 $ echo dh > dh
816 $ hg add dh
817 $ hg ci -m "added d"
818 created new head
819
820 $ hg glog
821 @ 5:e800202333a4 added d
822 | draft
823 |
824 | o 4:5acd58ef5066 added dh
825 | | draft
826 | |
827 +---o 3:9150fe93bec6 added d
828 | | draft
829 | |
830 o | 2:155349b645be added c
831 |/ draft
832 |
833 o 1:5f6d8a4bf34a added b
834 | draft
835 |
836 o 0:9092f1db7931 added a
837 draft
838
839
840 $ hg prune 3 -s 4
841 1 changesets pruned
842 $ hg prune 3 -s 5 --hidden
843 1 changesets pruned
844 2 new content-divergent changesets
845 $ hg phase --public -r 5
846
847 $ hg glog
848 @ 5:e800202333a4 added d
849 | public
850 |
851 | * 4:5acd58ef5066 added dh
852 | | draft content-divergent
853 | |
854 o | 2:155349b645be added c
855 |/ public
856 |
857 o 1:5f6d8a4bf34a added b
858 | public
859 |
860 o 0:9092f1db7931 added a
861 public
862
863 $ hg evolve --content-divergent --any
864 merge:[5] added d
865 with: [4] added dh
866 base: [3] added d
867 rebasing "other" content-divergent changeset 5acd58ef5066 on 155349b645be
868 updating to "local" side of the conflict: e800202333a4
869 merging "other" content-divergent changeset 'ae3429430ef1'
870 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
871
872 $ hg evolve -l
873
874 $ hg par
875 changeset: 5:e800202333a4
876 tag: tip
877 parent: 2:155349b645be
878 user: test
879 date: Thu Jan 01 00:00:00 1970 +0000
880 summary: added d
881
882 Testing the case when "merging results in same as public cset" where:
883 both the csets are on same parent and merging leads to conflict.
884 ---------------------------------------------------------------------
885
886 Prepare the repo:
887
888 $ cd ..
889 $ hg init pubdiv7
890 $ cd pubdiv7
891 $ for ch in a b c; do
892 > echo $ch > $ch;
893 > hg ci -Am "added "$ch;
894 > done;
895 adding a
896 adding b
897 adding c
898
899 $ hg up .^
900 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
901 $ echo chconflict > ch
902 $ hg add ch
903 $ hg ci -m "added ch"
904 created new head
905
906 $ hg up .^
907 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
908 $ echo ch > ch
909 $ hg add ch
910 $ hg ci -m "added c"
911 created new head
912
913 $ hg glog
914 @ 4:f7c1071f1e7c added c
915 | draft
916 |
917 | o 3:229da2719b19 added ch
918 |/ draft
919 |
920 | o 2:155349b645be added c
921 |/ draft
922 |
923 o 1:5f6d8a4bf34a added b
924 | draft
925 |
926 o 0:9092f1db7931 added a
927 draft
928
929
930 $ hg prune 2 -s 3
931 1 changesets pruned
932 $ hg prune 2 -s 4 --hidden
933 1 changesets pruned
934 2 new content-divergent changesets
935 $ hg phase --public -r 4
936
937 $ hg glog
938 @ 4:f7c1071f1e7c added c
939 | public
940 |
941 | * 3:229da2719b19 added ch
942 |/ draft content-divergent
943 |
944 o 1:5f6d8a4bf34a added b
945 | public
946 |
947 o 0:9092f1db7931 added a
948 public
949
950 $ hg evolve --content-divergent --any
951 merge:[4] added c
952 with: [3] added ch
953 base: [2] added c
954 merging "other" content-divergent changeset '229da2719b19'
955 merging ch
956 warning: conflicts while merging ch! (edit, then use 'hg resolve --mark')
957 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
958 fix conflicts and see `hg help evolve.interrupted`
959 [1]
960
961 $ hg diff
962 diff -r f7c1071f1e7c ch
963 --- a/ch Thu Jan 01 00:00:00 1970 +0000
964 +++ b/ch Thu Jan 01 00:00:00 1970 +0000
965 @@ -1,1 +1,5 @@
966 +<<<<<<< local: f7c1071f1e7c - test: added c
967 ch
968 +=======
969 +chconflict
970 +>>>>>>> other: 229da2719b19 - test: added ch
971
972 $ echo ch > ch
973 $ hg res -m
974 (no more unresolved files)
975 continue: hg evolve --continue
976
977 $ hg evolve --continue
978 computing new diff
979 transaction abort!
980 rollback completed
981 abort: cannot obsolete public changeset: f7c1071f1e7c
982 (see 'hg help phases' for details)
983 [255]
984
985 $ hg evolve -l
986 229da2719b19: added ch
987 content-divergent: f7c1071f1e7c (public) (precursor 155349b645be)
988
989
990 $ hg par
991 changeset: 4:f7c1071f1e7c
992 tag: tip
993 parent: 1:5f6d8a4bf34a
994 user: test
995 date: Thu Jan 01 00:00:00 1970 +0000
996 summary: added c
997
998 changeset: 3:229da2719b19
999 parent: 1:5f6d8a4bf34a
1000 user: test
1001 date: Thu Jan 01 00:00:00 1970 +0000
1002 instability: content-divergent
1003 summary: added ch
1004