comparison tests/test-strip.t @ 34621:5613fb1583d6

strip: take branch into account when selecting update target (issue5540) Test contributed by Matt Harbison Keep the same behavior in most cases (i.e. first parent of the first root of stripped changsets), but if the branch differs from wdir's, try to find another parent of stripped commits that is on the same branch.
author Paul Morelle <paul.morelle@octobus.net>
date Thu, 05 Oct 2017 16:13:05 +0200
parents 40b6d25ed2d5
children eb586ed5d8ce
comparison
equal deleted inserted replaced
34620:b799f11644d8 34621:5613fb1583d6
939 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob) 939 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob)
940 strip failed, backup bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' (glob) 940 strip failed, backup bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' (glob)
941 abort: boom 941 abort: boom
942 [255] 942 [255]
943 943
944 test stripping a working directory parent doesn't switch named branches
945
946 $ hg log -G
947 @ changeset: 1:eca11cf91c71
948 | tag: tip
949 | user: test
950 | date: Thu Jan 01 00:00:00 1970 +0000
951 | summary: commitB
952 |
953 o changeset: 0:105141ef12d0
954 user: test
955 date: Thu Jan 01 00:00:00 1970 +0000
956 summary: commitA
957
958
959 $ hg branch new-branch
960 marked working directory as branch new-branch
961 (branches are permanent and global, did you want a bookmark?)
962 $ hg ci -m "start new branch"
963 $ echo 'foo' > foo.txt
964 $ hg ci -Aqm foo
965 $ hg up default
966 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
967 $ echo 'bar' > bar.txt
968 $ hg ci -Aqm bar
969 $ hg up new-branch
970 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
971 $ hg merge default
972 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
973 (branch merge, don't forget to commit)
974 $ hg log -G
975 @ changeset: 4:35358f982181
976 | tag: tip
977 | parent: 1:eca11cf91c71
978 | user: test
979 | date: Thu Jan 01 00:00:00 1970 +0000
980 | summary: bar
981 |
982 | @ changeset: 3:f62c6c09b707
983 | | branch: new-branch
984 | | user: test
985 | | date: Thu Jan 01 00:00:00 1970 +0000
986 | | summary: foo
987 | |
988 | o changeset: 2:b1d33a8cadd9
989 |/ branch: new-branch
990 | user: test
991 | date: Thu Jan 01 00:00:00 1970 +0000
992 | summary: start new branch
993 |
994 o changeset: 1:eca11cf91c71
995 | user: test
996 | date: Thu Jan 01 00:00:00 1970 +0000
997 | summary: commitB
998 |
999 o changeset: 0:105141ef12d0
1000 user: test
1001 date: Thu Jan 01 00:00:00 1970 +0000
1002 summary: commitA
1003
1004
1005 $ hg strip --force -r 35358f982181
1006 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1007 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-50d992d4-backup.hg (glob)
1008 $ hg log -G
1009 @ changeset: 3:f62c6c09b707
1010 | branch: new-branch
1011 | tag: tip
1012 | user: test
1013 | date: Thu Jan 01 00:00:00 1970 +0000
1014 | summary: foo
1015 |
1016 o changeset: 2:b1d33a8cadd9
1017 | branch: new-branch
1018 | user: test
1019 | date: Thu Jan 01 00:00:00 1970 +0000
1020 | summary: start new branch
1021 |
1022 o changeset: 1:eca11cf91c71
1023 | user: test
1024 | date: Thu Jan 01 00:00:00 1970 +0000
1025 | summary: commitB
1026 |
1027 o changeset: 0:105141ef12d0
1028 user: test
1029 date: Thu Jan 01 00:00:00 1970 +0000
1030 summary: commitA
1031
1032
1033 $ hg up default
1034 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1035 $ echo 'bar' > bar.txt
1036 $ hg ci -Aqm bar
1037 $ hg up new-branch
1038 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1039 $ hg merge default
1040 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1041 (branch merge, don't forget to commit)
1042 $ hg ci -m merge
1043 $ hg log -G
1044 @ changeset: 5:4cf5e92caec2
1045 |\ branch: new-branch
1046 | | tag: tip
1047 | | parent: 3:f62c6c09b707
1048 | | parent: 4:35358f982181
1049 | | user: test
1050 | | date: Thu Jan 01 00:00:00 1970 +0000
1051 | | summary: merge
1052 | |
1053 | o changeset: 4:35358f982181
1054 | | parent: 1:eca11cf91c71
1055 | | user: test
1056 | | date: Thu Jan 01 00:00:00 1970 +0000
1057 | | summary: bar
1058 | |
1059 o | changeset: 3:f62c6c09b707
1060 | | branch: new-branch
1061 | | user: test
1062 | | date: Thu Jan 01 00:00:00 1970 +0000
1063 | | summary: foo
1064 | |
1065 o | changeset: 2:b1d33a8cadd9
1066 |/ branch: new-branch
1067 | user: test
1068 | date: Thu Jan 01 00:00:00 1970 +0000
1069 | summary: start new branch
1070 |
1071 o changeset: 1:eca11cf91c71
1072 | user: test
1073 | date: Thu Jan 01 00:00:00 1970 +0000
1074 | summary: commitB
1075 |
1076 o changeset: 0:105141ef12d0
1077 user: test
1078 date: Thu Jan 01 00:00:00 1970 +0000
1079 summary: commitA
1080
1081
1082 $ hg strip -r 35358f982181
1083 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1084 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg (glob)
1085 $ hg log -G
1086 @ changeset: 3:f62c6c09b707
1087 | branch: new-branch
1088 | tag: tip
1089 | user: test
1090 | date: Thu Jan 01 00:00:00 1970 +0000
1091 | summary: foo
1092 |
1093 o changeset: 2:b1d33a8cadd9
1094 | branch: new-branch
1095 | user: test
1096 | date: Thu Jan 01 00:00:00 1970 +0000
1097 | summary: start new branch
1098 |
1099 o changeset: 1:eca11cf91c71
1100 | user: test
1101 | date: Thu Jan 01 00:00:00 1970 +0000
1102 | summary: commitB
1103 |
1104 o changeset: 0:105141ef12d0
1105 user: test
1106 date: Thu Jan 01 00:00:00 1970 +0000
1107 summary: commitA
1108
1109
1110 $ hg pull -u $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
1111 pulling from $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg (glob)
1112 searching for changes
1113 adding changesets
1114 adding manifests
1115 adding file changes
1116 added 2 changesets with 1 changes to 1 files
1117 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1118
1119 $ hg strip -k -r 35358f982181
1120 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg (glob)
1121 $ hg log -G
1122 @ changeset: 3:f62c6c09b707
1123 | branch: new-branch
1124 | tag: tip
1125 | user: test
1126 | date: Thu Jan 01 00:00:00 1970 +0000
1127 | summary: foo
1128 |
1129 o changeset: 2:b1d33a8cadd9
1130 | branch: new-branch
1131 | user: test
1132 | date: Thu Jan 01 00:00:00 1970 +0000
1133 | summary: start new branch
1134 |
1135 o changeset: 1:eca11cf91c71
1136 | user: test
1137 | date: Thu Jan 01 00:00:00 1970 +0000
1138 | summary: commitB
1139 |
1140 o changeset: 0:105141ef12d0
1141 user: test
1142 date: Thu Jan 01 00:00:00 1970 +0000
1143 summary: commitA
1144
1145 $ hg diff
1146 diff -r f62c6c09b707 bar.txt
1147 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1148 +++ b/bar.txt Thu Jan 01 00:00:00 1970 +0000
1149 @@ -0,0 +1,1 @@
1150 +bar
1151
944 Use delayedstrip to strip inside a transaction 1152 Use delayedstrip to strip inside a transaction
945 1153
946 $ cd $TESTTMP 1154 $ cd $TESTTMP
947 $ hg init delayedstrip 1155 $ hg init delayedstrip
948 $ cd delayedstrip 1156 $ cd delayedstrip