##// END OF EJS Templates
tests: split up test-rebase-obsolete.t in four pieces...
Martin von Zweigbergk -
r47585:13b200ff default
parent child Browse files
Show More
This diff has been collapsed as it changes many lines, (1393 lines changed) Show them Hide them
@@ -743,1396 +743,3 b' Test hidden changesets in the rebase set'
743 1 new orphan changesets
743 1 new orphan changesets
744
744
745 $ cd ..
745 $ cd ..
746
747 Skip obsolete changeset even with multiple hops
748 -----------------------------------------------
749
750 setup
751
752 $ hg init obsskip
753 $ cd obsskip
754 $ cat << EOF >> .hg/hgrc
755 > [experimental]
756 > rebaseskipobsolete = True
757 > [extensions]
758 > strip =
759 > EOF
760 $ echo A > A
761 $ hg add A
762 $ hg commit -m A
763 $ echo B > B
764 $ hg add B
765 $ hg commit -m B0
766 $ hg commit --amend -m B1
767 $ hg commit --amend -m B2
768 $ hg up --hidden 'desc(B0)'
769 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
770 updated to hidden changeset a8b11f55fb19
771 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
772 $ echo C > C
773 $ hg add C
774 $ hg commit -m C
775 1 new orphan changesets
776 $ hg log -G
777 @ 4:212cb178bcbb C
778 |
779 | o 3:261e70097290 B2
780 | |
781 x | 1:a8b11f55fb19 B0 (rewritten using amend as 3:261e70097290)
782 |/
783 o 0:4a2df7238c3b A
784
785
786 Rebase finds its way in a chain of marker
787
788 $ hg rebase -d 'desc(B2)'
789 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
790 rebasing 4:212cb178bcbb tip "C"
791
792 Even when the chain include missing node
793
794 $ hg up --hidden 'desc(B0)'
795 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
796 updated to hidden changeset a8b11f55fb19
797 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
798 $ echo D > D
799 $ hg add D
800 $ hg commit -m D
801 1 new orphan changesets
802 $ hg --hidden strip -r 'desc(B1)'
803 saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg
804 1 new orphan changesets
805 $ hg log -G
806 @ 5:1a79b7535141 D
807 |
808 | o 4:ff2c4d47b71d C
809 | |
810 | o 2:261e70097290 B2
811 | |
812 x | 1:a8b11f55fb19 B0 (rewritten using amend as 2:261e70097290)
813 |/
814 o 0:4a2df7238c3b A
815
816
817 $ hg rebase -d 'desc(B2)'
818 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
819 rebasing 5:1a79b7535141 tip "D"
820 $ hg up 4
821 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
822 $ echo "O" > O
823 $ hg add O
824 $ hg commit -m O
825 $ echo "P" > P
826 $ hg add P
827 $ hg commit -m P
828 $ hg log -G
829 @ 8:8d47583e023f P
830 |
831 o 7:360bbaa7d3ce O
832 |
833 | o 6:9c48361117de D
834 | |
835 o | 4:ff2c4d47b71d C
836 |/
837 o 2:261e70097290 B2
838 |
839 o 0:4a2df7238c3b A
840
841 $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=true
842 1 new obsolescence markers
843 obsoleted 1 changesets
844 1 new orphan changesets
845 $ hg rebase -d 6 -r "4::"
846 rebasing 4:ff2c4d47b71d "C"
847 note: not rebasing 7:360bbaa7d3ce "O", it has no successor
848 rebasing 8:8d47583e023f tip "P"
849
850 If all the changeset to be rebased are obsolete and present in the destination, we
851 should display a friendly error message
852
853 $ hg log -G
854 @ 10:121d9e3bc4c6 P
855 |
856 o 9:4be60e099a77 C
857 |
858 o 6:9c48361117de D
859 |
860 o 2:261e70097290 B2
861 |
862 o 0:4a2df7238c3b A
863
864
865 $ hg up 9
866 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
867 $ echo "non-relevant change" > nonrelevant
868 $ hg add nonrelevant
869 $ hg commit -m nonrelevant
870 created new head
871 $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=true
872 1 new obsolescence markers
873 obsoleted 1 changesets
874 $ hg log -G
875 @ 11:f44da1f4954c nonrelevant (pruned)
876 |
877 | o 10:121d9e3bc4c6 P
878 |/
879 o 9:4be60e099a77 C
880 |
881 o 6:9c48361117de D
882 |
883 o 2:261e70097290 B2
884 |
885 o 0:4a2df7238c3b A
886
887 $ hg rebase -r . -d 10
888 note: not rebasing 11:f44da1f4954c tip "nonrelevant", it has no successor
889
890 If a rebase is going to create divergence, it should abort
891
892 $ hg log -G
893 @ 10:121d9e3bc4c6 P
894 |
895 o 9:4be60e099a77 C
896 |
897 o 6:9c48361117de D
898 |
899 o 2:261e70097290 B2
900 |
901 o 0:4a2df7238c3b A
902
903
904 $ hg up 9
905 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
906 $ echo "john" > doe
907 $ hg add doe
908 $ hg commit -m "john doe"
909 created new head
910 $ hg up 10
911 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
912 $ echo "foo" > bar
913 $ hg add bar
914 $ hg commit --amend -m "10'"
915 $ hg up 10 --hidden
916 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
917 updated to hidden changeset 121d9e3bc4c6
918 (hidden revision '121d9e3bc4c6' was rewritten as: 77d874d096a2)
919 $ echo "bar" > foo
920 $ hg add foo
921 $ hg commit -m "bar foo"
922 1 new orphan changesets
923 $ hg log -G
924 @ 14:73568ab6879d bar foo
925 |
926 | o 13:77d874d096a2 10'
927 | |
928 | | o 12:3eb461388009 john doe
929 | |/
930 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
931 |/
932 o 9:4be60e099a77 C
933 |
934 o 6:9c48361117de D
935 |
936 o 2:261e70097290 B2
937 |
938 o 0:4a2df7238c3b A
939
940 $ hg summary
941 parent: 14:73568ab6879d tip (orphan)
942 bar foo
943 branch: default
944 commit: (clean)
945 update: 2 new changesets, 3 branch heads (merge)
946 phases: 8 draft
947 orphan: 1 changesets
948 $ hg rebase -s 10 -d 12
949 abort: this rebase will cause divergences from: 121d9e3bc4c6
950 (to force the rebase please set experimental.evolution.allowdivergence=True)
951 [20]
952 $ hg log -G
953 @ 14:73568ab6879d bar foo
954 |
955 | o 13:77d874d096a2 10'
956 | |
957 | | o 12:3eb461388009 john doe
958 | |/
959 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
960 |/
961 o 9:4be60e099a77 C
962 |
963 o 6:9c48361117de D
964 |
965 o 2:261e70097290 B2
966 |
967 o 0:4a2df7238c3b A
968
969 With experimental.evolution.allowdivergence=True, rebase can create divergence
970
971 $ hg rebase -s 10 -d 12 --config experimental.evolution.allowdivergence=True
972 rebasing 10:121d9e3bc4c6 "P"
973 rebasing 14:73568ab6879d tip "bar foo"
974 2 new content-divergent changesets
975 $ hg summary
976 parent: 16:61bd55f69bc4 tip
977 bar foo
978 branch: default
979 commit: (clean)
980 update: 1 new changesets, 2 branch heads (merge)
981 phases: 8 draft
982 content-divergent: 2 changesets
983
984 rebase --continue + skipped rev because their successors are in destination
985 we make a change in trunk and work on conflicting changes to make rebase abort.
986
987 $ hg log -G -r 16::
988 @ 16:61bd55f69bc4 bar foo
989 |
990 ~
991
992 Create the two changes in trunk
993 $ printf "a" > willconflict
994 $ hg add willconflict
995 $ hg commit -m "willconflict first version"
996
997 $ printf "dummy" > C
998 $ hg commit -m "dummy change successor"
999
1000 Create the changes that we will rebase
1001 $ hg update -C 16 -q
1002 $ printf "b" > willconflict
1003 $ hg add willconflict
1004 $ hg commit -m "willconflict second version"
1005 created new head
1006 $ printf "dummy" > K
1007 $ hg add K
1008 $ hg commit -m "dummy change"
1009 $ printf "dummy" > L
1010 $ hg add L
1011 $ hg commit -m "dummy change"
1012 $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 18 -T '{node}'` --config experimental.evolution=true
1013 1 new obsolescence markers
1014 obsoleted 1 changesets
1015 1 new orphan changesets
1016
1017 $ hg log -G -r 16::
1018 @ 21:7bdc8a87673d dummy change
1019 |
1020 x 20:8b31da3c4919 dummy change (rewritten as 18:601db7a18f51)
1021 |
1022 o 19:b82fb57ea638 willconflict second version
1023 |
1024 | o 18:601db7a18f51 dummy change successor
1025 | |
1026 | o 17:357ddf1602d5 willconflict first version
1027 |/
1028 o 16:61bd55f69bc4 bar foo
1029 |
1030 ~
1031 $ hg rebase -r ".^^ + .^ + ." -d 18
1032 rebasing 19:b82fb57ea638 "willconflict second version"
1033 merging willconflict
1034 warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark')
1035 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1036 [240]
1037
1038 $ hg resolve --mark willconflict
1039 (no more unresolved files)
1040 continue: hg rebase --continue
1041 $ hg rebase --continue
1042 rebasing 19:b82fb57ea638 "willconflict second version"
1043 note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
1044 rebasing 21:7bdc8a87673d tip "dummy change"
1045 $ cd ..
1046
1047 Divergence cases due to obsolete changesets
1048 -------------------------------------------
1049
1050 We should ignore branches with unstable changesets when they are based on an
1051 obsolete changeset which successor is in rebase set.
1052
1053 $ hg init divergence
1054 $ cd divergence
1055 $ cat >> .hg/hgrc << EOF
1056 > [extensions]
1057 > strip =
1058 > [alias]
1059 > strip = strip --no-backup --quiet
1060 > [templates]
1061 > instabilities = '{rev}:{node|short} {desc|firstline}{if(instabilities," ({instabilities})")}\n'
1062 > EOF
1063
1064 $ hg debugdrawdag <<EOF
1065 > e f
1066 > | |
1067 > d' d # replace: d -> d'
1068 > \ /
1069 > c
1070 > |
1071 > x b
1072 > \|
1073 > a
1074 > EOF
1075 1 new orphan changesets
1076 $ hg log -G -r 'a'::
1077 * 7:1143e9adc121 f
1078 |
1079 | o 6:d60ebfa0f1cb e
1080 | |
1081 | o 5:027ad6c5830d d'
1082 | |
1083 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1084 |/
1085 o 3:a82ac2b38757 c
1086 |
1087 | o 2:630d7c95eff7 x
1088 | |
1089 o | 1:488e1b7e7341 b
1090 |/
1091 o 0:b173517d0057 a
1092
1093
1094 Changeset d and its descendants are excluded to avoid divergence of d, which
1095 would occur because the successor of d (d') is also in rebaseset. As a
1096 consequence f (descendant of d) is left behind.
1097
1098 $ hg rebase -b 'e' -d 'x'
1099 rebasing 1:488e1b7e7341 b "b"
1100 rebasing 3:a82ac2b38757 c "c"
1101 rebasing 5:027ad6c5830d d' "d'"
1102 rebasing 6:d60ebfa0f1cb e "e"
1103 note: not rebasing 4:76be324c128b d "d" and its descendants as this would cause divergence
1104 $ hg log -G -r 'a'::
1105 o 11:eb6d63fc4ed5 e
1106 |
1107 o 10:44d8c724a70c d'
1108 |
1109 o 9:d008e6b4d3fd c
1110 |
1111 o 8:67e8f4a16c49 b
1112 |
1113 | * 7:1143e9adc121 f
1114 | |
1115 | | x 6:d60ebfa0f1cb e (rewritten using rebase as 11:eb6d63fc4ed5)
1116 | | |
1117 | | x 5:027ad6c5830d d' (rewritten using rebase as 10:44d8c724a70c)
1118 | | |
1119 | x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1120 | |/
1121 | x 3:a82ac2b38757 c (rewritten using rebase as 9:d008e6b4d3fd)
1122 | |
1123 o | 2:630d7c95eff7 x
1124 | |
1125 | x 1:488e1b7e7341 b (rewritten using rebase as 8:67e8f4a16c49)
1126 |/
1127 o 0:b173517d0057 a
1128
1129 $ hg strip -r 8:
1130 $ hg log -G -r 'a'::
1131 * 7:1143e9adc121 f
1132 |
1133 | o 6:d60ebfa0f1cb e
1134 | |
1135 | o 5:027ad6c5830d d'
1136 | |
1137 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1138 |/
1139 o 3:a82ac2b38757 c
1140 |
1141 | o 2:630d7c95eff7 x
1142 | |
1143 o | 1:488e1b7e7341 b
1144 |/
1145 o 0:b173517d0057 a
1146
1147
1148 If the rebase set has an obsolete (d) with a successor (d') outside the rebase
1149 set and none in destination, we still get the divergence warning.
1150 By allowing divergence, we can perform the rebase.
1151
1152 $ hg rebase -r 'c'::'f' -d 'x'
1153 abort: this rebase will cause divergences from: 76be324c128b
1154 (to force the rebase please set experimental.evolution.allowdivergence=True)
1155 [20]
1156 $ hg rebase --config experimental.evolution.allowdivergence=true -r 'c'::'f' -d 'x'
1157 rebasing 3:a82ac2b38757 c "c"
1158 rebasing 4:76be324c128b d "d"
1159 rebasing 7:1143e9adc121 f tip "f"
1160 1 new orphan changesets
1161 2 new content-divergent changesets
1162 $ hg log -G -r 'a':: -T instabilities
1163 o 10:e1744ea07510 f
1164 |
1165 * 9:e2b36ea9a0a0 d (content-divergent)
1166 |
1167 o 8:6a0376de376e c
1168 |
1169 | x 7:1143e9adc121 f
1170 | |
1171 | | * 6:d60ebfa0f1cb e (orphan)
1172 | | |
1173 | | * 5:027ad6c5830d d' (orphan content-divergent)
1174 | | |
1175 | x | 4:76be324c128b d
1176 | |/
1177 | x 3:a82ac2b38757 c
1178 | |
1179 o | 2:630d7c95eff7 x
1180 | |
1181 | o 1:488e1b7e7341 b
1182 |/
1183 o 0:b173517d0057 a
1184
1185 $ hg strip -r 8:
1186
1187 (Not skipping obsoletes means that divergence is allowed.)
1188
1189 $ hg rebase --config experimental.rebaseskipobsolete=false -r 'c'::'f' -d 'x'
1190 rebasing 3:a82ac2b38757 c "c"
1191 rebasing 4:76be324c128b d "d"
1192 rebasing 7:1143e9adc121 f tip "f"
1193 1 new orphan changesets
1194 2 new content-divergent changesets
1195
1196 $ hg strip -r 0:
1197
1198 Similar test on a more complex graph
1199
1200 $ hg debugdrawdag <<EOF
1201 > g
1202 > |
1203 > f e
1204 > | |
1205 > e' d # replace: e -> e'
1206 > \ /
1207 > c
1208 > |
1209 > x b
1210 > \|
1211 > a
1212 > EOF
1213 1 new orphan changesets
1214 $ hg log -G -r 'a':
1215 * 8:2876ce66c6eb g
1216 |
1217 | o 7:3ffec603ab53 f
1218 | |
1219 x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1220 | |
1221 | o 5:63324dc512ea e'
1222 | |
1223 o | 4:76be324c128b d
1224 |/
1225 o 3:a82ac2b38757 c
1226 |
1227 | o 2:630d7c95eff7 x
1228 | |
1229 o | 1:488e1b7e7341 b
1230 |/
1231 o 0:b173517d0057 a
1232
1233 $ hg rebase -b 'f' -d 'x'
1234 rebasing 1:488e1b7e7341 b "b"
1235 rebasing 3:a82ac2b38757 c "c"
1236 rebasing 5:63324dc512ea e' "e'"
1237 rebasing 7:3ffec603ab53 f "f"
1238 rebasing 4:76be324c128b d "d"
1239 note: not rebasing 6:e36fae928aec e "e" and its descendants as this would cause divergence
1240 $ hg log -G -r 'a':
1241 o 13:a1707a5b7c2c d
1242 |
1243 | o 12:ef6251596616 f
1244 | |
1245 | o 11:b6f172e64af9 e'
1246 |/
1247 o 10:d008e6b4d3fd c
1248 |
1249 o 9:67e8f4a16c49 b
1250 |
1251 | * 8:2876ce66c6eb g
1252 | |
1253 | | x 7:3ffec603ab53 f (rewritten using rebase as 12:ef6251596616)
1254 | | |
1255 | x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1256 | | |
1257 | | x 5:63324dc512ea e' (rewritten using rebase as 11:b6f172e64af9)
1258 | | |
1259 | x | 4:76be324c128b d (rewritten using rebase as 13:a1707a5b7c2c)
1260 | |/
1261 | x 3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd)
1262 | |
1263 o | 2:630d7c95eff7 x
1264 | |
1265 | x 1:488e1b7e7341 b (rewritten using rebase as 9:67e8f4a16c49)
1266 |/
1267 o 0:b173517d0057 a
1268
1269
1270 issue5782
1271 $ hg strip -r 0:
1272 $ hg debugdrawdag <<EOF
1273 > d
1274 > |
1275 > c1 c # replace: c -> c1
1276 > \ /
1277 > b
1278 > |
1279 > a
1280 > EOF
1281 1 new orphan changesets
1282 $ hg debugobsolete `hg log -T "{node}" --hidden -r 'desc("c1")'`
1283 1 new obsolescence markers
1284 obsoleted 1 changesets
1285 $ hg log -G -r 'a': --hidden
1286 * 4:76be324c128b d
1287 |
1288 | x 3:ef8a456de8fa c1 (pruned)
1289 | |
1290 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa)
1291 |/
1292 o 1:488e1b7e7341 b
1293 |
1294 o 0:b173517d0057 a
1295
1296 $ hg rebase -d 0 -r 2
1297 note: not rebasing 2:a82ac2b38757 c "c", it has no successor
1298 $ hg log -G -r 'a': --hidden
1299 * 4:76be324c128b d
1300 |
1301 | x 3:ef8a456de8fa c1 (pruned)
1302 | |
1303 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa)
1304 |/
1305 o 1:488e1b7e7341 b
1306 |
1307 o 0:b173517d0057 a
1308
1309 $ cd ..
1310
1311 Rebase merge where successor of one parent is equal to destination (issue5198)
1312
1313 $ hg init p1-succ-is-dest
1314 $ cd p1-succ-is-dest
1315
1316 $ hg debugdrawdag <<EOF
1317 > F
1318 > /|
1319 > E D B # replace: D -> B
1320 > \|/
1321 > A
1322 > EOF
1323 1 new orphan changesets
1324
1325 $ hg rebase -d B -s D
1326 note: not rebasing 2:b18e25de2cf5 D "D", already in destination as 1:112478962961 B "B"
1327 rebasing 4:66f1a38021c9 F tip "F"
1328 $ hg log -G
1329 o 5:50e9d60b99c6 F
1330 |\
1331 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:50e9d60b99c6)
1332 | |/|
1333 | o | 3:7fb047a69f22 E
1334 | | |
1335 | | x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1336 | |/
1337 o | 1:112478962961 B
1338 |/
1339 o 0:426bada5c675 A
1340
1341 $ cd ..
1342
1343 Rebase merge where successor of other parent is equal to destination
1344
1345 $ hg init p2-succ-is-dest
1346 $ cd p2-succ-is-dest
1347
1348 $ hg debugdrawdag <<EOF
1349 > F
1350 > /|
1351 > E D B # replace: E -> B
1352 > \|/
1353 > A
1354 > EOF
1355 1 new orphan changesets
1356
1357 $ hg rebase -d B -s E
1358 note: not rebasing 3:7fb047a69f22 E "E", already in destination as 1:112478962961 B "B"
1359 rebasing 4:66f1a38021c9 F tip "F"
1360 $ hg log -G
1361 o 5:aae1787dacee F
1362 |\
1363 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:aae1787dacee)
1364 | |/|
1365 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1366 | | |
1367 | o | 2:b18e25de2cf5 D
1368 | |/
1369 o / 1:112478962961 B
1370 |/
1371 o 0:426bada5c675 A
1372
1373 $ cd ..
1374
1375 Rebase merge where successor of one parent is ancestor of destination
1376
1377 $ hg init p1-succ-in-dest
1378 $ cd p1-succ-in-dest
1379
1380 $ hg debugdrawdag <<EOF
1381 > F C
1382 > /| |
1383 > E D B # replace: D -> B
1384 > \|/
1385 > A
1386 > EOF
1387 1 new orphan changesets
1388
1389 $ hg rebase -d C -s D
1390 note: not rebasing 2:b18e25de2cf5 D "D", already in destination as 1:112478962961 B "B"
1391 rebasing 5:66f1a38021c9 F tip "F"
1392
1393 $ hg log -G
1394 o 6:0913febf6439 F
1395 |\
1396 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:0913febf6439)
1397 | | |
1398 | o | 4:26805aba1e60 C
1399 | | |
1400 o | | 3:7fb047a69f22 E
1401 | | |
1402 +---x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1403 | |
1404 | o 1:112478962961 B
1405 |/
1406 o 0:426bada5c675 A
1407
1408 $ cd ..
1409
1410 Rebase merge where successor of other parent is ancestor of destination
1411
1412 $ hg init p2-succ-in-dest
1413 $ cd p2-succ-in-dest
1414
1415 $ hg debugdrawdag <<EOF
1416 > F C
1417 > /| |
1418 > E D B # replace: E -> B
1419 > \|/
1420 > A
1421 > EOF
1422 1 new orphan changesets
1423
1424 $ hg rebase -d C -s E
1425 note: not rebasing 3:7fb047a69f22 E "E", already in destination as 1:112478962961 B "B"
1426 rebasing 5:66f1a38021c9 F tip "F"
1427 $ hg log -G
1428 o 6:c6ab0cc6d220 F
1429 |\
1430 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:c6ab0cc6d220)
1431 | | |
1432 | o | 4:26805aba1e60 C
1433 | | |
1434 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1435 | | |
1436 o---+ 2:b18e25de2cf5 D
1437 / /
1438 o / 1:112478962961 B
1439 |/
1440 o 0:426bada5c675 A
1441
1442 $ cd ..
1443
1444 Rebase merge where successor of one parent is ancestor of destination
1445
1446 $ hg init p1-succ-in-dest-b
1447 $ cd p1-succ-in-dest-b
1448
1449 $ hg debugdrawdag <<EOF
1450 > F C
1451 > /| |
1452 > E D B # replace: E -> B
1453 > \|/
1454 > A
1455 > EOF
1456 1 new orphan changesets
1457
1458 $ hg rebase -d C -b F
1459 rebasing 2:b18e25de2cf5 D "D"
1460 note: not rebasing 3:7fb047a69f22 E "E", already in destination as 1:112478962961 B "B"
1461 rebasing 5:66f1a38021c9 F tip "F"
1462 note: not rebasing 5:66f1a38021c9 F tip "F", its destination already has all its changes
1463 $ hg log -G
1464 o 6:8f47515dda15 D
1465 |
1466 | x 5:66f1a38021c9 F (pruned using rebase)
1467 | |\
1468 o | | 4:26805aba1e60 C
1469 | | |
1470 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1471 | | |
1472 | x | 2:b18e25de2cf5 D (rewritten using rebase as 6:8f47515dda15)
1473 | |/
1474 o / 1:112478962961 B
1475 |/
1476 o 0:426bada5c675 A
1477
1478 $ cd ..
1479
1480 Rebase merge where successor of other parent is ancestor of destination
1481
1482 $ hg init p2-succ-in-dest-b
1483 $ cd p2-succ-in-dest-b
1484
1485 $ hg debugdrawdag <<EOF
1486 > F C
1487 > /| |
1488 > E D B # replace: D -> B
1489 > \|/
1490 > A
1491 > EOF
1492 1 new orphan changesets
1493
1494 $ hg rebase -d C -b F
1495 note: not rebasing 2:b18e25de2cf5 D "D", already in destination as 1:112478962961 B "B"
1496 rebasing 3:7fb047a69f22 E "E"
1497 rebasing 5:66f1a38021c9 F tip "F"
1498 note: not rebasing 5:66f1a38021c9 F tip "F", its destination already has all its changes
1499
1500 $ hg log -G
1501 o 6:533690786a86 E
1502 |
1503 | x 5:66f1a38021c9 F (pruned using rebase)
1504 | |\
1505 o | | 4:26805aba1e60 C
1506 | | |
1507 | | x 3:7fb047a69f22 E (rewritten using rebase as 6:533690786a86)
1508 | | |
1509 | x | 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1510 | |/
1511 o / 1:112478962961 B
1512 |/
1513 o 0:426bada5c675 A
1514
1515 $ cd ..
1516
1517 Rebase merge where extinct node has successor that is not an ancestor of
1518 destination
1519
1520 $ hg init extinct-with-succ-not-in-dest
1521 $ cd extinct-with-succ-not-in-dest
1522
1523 $ hg debugdrawdag <<EOF
1524 > E C # replace: C -> E
1525 > | |
1526 > D B
1527 > |/
1528 > A
1529 > EOF
1530
1531 $ hg rebase -d D -s B
1532 rebasing 1:112478962961 B "B"
1533 note: not rebasing 3:26805aba1e60 C "C" and its descendants as this would cause divergence
1534
1535 $ cd ..
1536
1537 $ hg init p2-succ-in-dest-c
1538 $ cd p2-succ-in-dest-c
1539
1540 The scenario here was that B::D were developed on default. B was queued on
1541 stable, but amended before being push to hg-committed. C was queued on default,
1542 along with unrelated J.
1543
1544 $ hg debugdrawdag <<EOF
1545 > J
1546 > |
1547 > F
1548 > |
1549 > E
1550 > | D
1551 > | |
1552 > | C # replace: C -> F
1553 > | | H I # replace: B -> H -> I
1554 > | B |/
1555 > |/ G
1556 > A
1557 > EOF
1558 1 new orphan changesets
1559
1560 This strip seems to be the key to avoid an early divergence warning.
1561 $ hg --config extensions.strip= --hidden strip -qr H
1562 1 new orphan changesets
1563
1564 $ hg rebase -b 'desc("D")' -d 'desc("J")'
1565 abort: this rebase will cause divergences from: 112478962961
1566 (to force the rebase please set experimental.evolution.allowdivergence=True)
1567 [20]
1568
1569 Rebase merge where both parents have successors in destination
1570
1571 $ hg init p12-succ-in-dest
1572 $ cd p12-succ-in-dest
1573 $ hg debugdrawdag <<'EOS'
1574 > E F
1575 > /| /| # replace: A -> C
1576 > A B C D # replace: B -> D
1577 > | |
1578 > X Y
1579 > EOS
1580 1 new orphan changesets
1581 $ hg rebase -r A+B+E -d F
1582 note: not rebasing 4:a3d17304151f A "A", already in destination as 0:96cc3511f894 C "C"
1583 note: not rebasing 5:b23a2cc00842 B "B", already in destination as 1:058c1e1fb10a D "D"
1584 rebasing 7:dac5d11c5a7d E tip "E"
1585 abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f
1586 [10]
1587 $ cd ..
1588
1589 Rebase a non-clean merge. One parent has successor in destination, the other
1590 parent moves as requested.
1591
1592 $ hg init p1-succ-p2-move
1593 $ cd p1-succ-p2-move
1594 $ hg debugdrawdag <<'EOS'
1595 > D Z
1596 > /| | # replace: A -> C
1597 > A B C # D/D = D
1598 > EOS
1599 1 new orphan changesets
1600 $ hg rebase -r A+B+D -d Z
1601 note: not rebasing 0:426bada5c675 A "A", already in destination as 2:96cc3511f894 C "C"
1602 rebasing 1:fc2b737bb2e5 B "B"
1603 rebasing 3:b8ed089c80ad D "D"
1604
1605 $ rm .hg/localtags
1606 $ hg log -G
1607 o 6:e4f78693cc88 D
1608 |
1609 o 5:76840d832e98 B
1610 |
1611 o 4:50e41c1f3950 Z
1612 |
1613 o 2:96cc3511f894 C
1614
1615 $ hg files -r tip
1616 B
1617 C
1618 D
1619 Z
1620
1621 $ cd ..
1622
1623 $ hg init p1-move-p2-succ
1624 $ cd p1-move-p2-succ
1625 $ hg debugdrawdag <<'EOS'
1626 > D Z
1627 > /| | # replace: B -> C
1628 > A B C # D/D = D
1629 > EOS
1630 1 new orphan changesets
1631 $ hg rebase -r B+A+D -d Z
1632 rebasing 0:426bada5c675 A "A"
1633 note: not rebasing 1:fc2b737bb2e5 B "B", already in destination as 2:96cc3511f894 C "C"
1634 rebasing 3:b8ed089c80ad D "D"
1635
1636 $ rm .hg/localtags
1637 $ hg log -G
1638 o 6:1b355ed94d82 D
1639 |
1640 o 5:a81a74d764a6 A
1641 |
1642 o 4:50e41c1f3950 Z
1643 |
1644 o 2:96cc3511f894 C
1645
1646 $ hg files -r tip
1647 A
1648 C
1649 D
1650 Z
1651
1652 $ cd ..
1653
1654 Test that bookmark is moved and working dir is updated when all changesets have
1655 equivalents in destination
1656 $ hg init rbsrepo && cd rbsrepo
1657 $ echo "[experimental]" > .hg/hgrc
1658 $ echo "evolution=true" >> .hg/hgrc
1659 $ echo "rebaseskipobsolete=on" >> .hg/hgrc
1660 $ echo root > root && hg ci -Am root
1661 adding root
1662 $ echo a > a && hg ci -Am a
1663 adding a
1664 $ hg up 0
1665 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1666 $ echo b > b && hg ci -Am b
1667 adding b
1668 created new head
1669 $ hg rebase -r 2 -d 1
1670 rebasing 2:1e9a3c00cbe9 tip "b"
1671 $ hg log -r . # working dir is at rev 3 (successor of 2)
1672 3:be1832deae9a b (no-eol)
1673 $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now
1674 bookmarking hidden changeset 1e9a3c00cbe9
1675 (hidden revision '1e9a3c00cbe9' was rewritten as: be1832deae9a)
1676 $ hg up 2 && hg log -r . # working dir is at rev 2 again
1677 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1678 2:1e9a3c00cbe9 b (rewritten using rebase as 3:be1832deae9a) (no-eol)
1679 $ hg rebase -r 2 -d 3 --config experimental.evolution.track-operation=1
1680 note: not rebasing 2:1e9a3c00cbe9 mybook "b", already in destination as 3:be1832deae9a tip "b"
1681 Check that working directory and bookmark was updated to rev 3 although rev 2
1682 was skipped
1683 $ hg log -r .
1684 3:be1832deae9a b (no-eol)
1685 $ hg bookmarks
1686 mybook 3:be1832deae9a
1687 $ hg debugobsolete --rev tip
1688 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
1689
1690 Obsoleted working parent and bookmark could be moved if an ancestor of working
1691 parent gets moved:
1692
1693 $ hg init $TESTTMP/ancestor-wd-move
1694 $ cd $TESTTMP/ancestor-wd-move
1695 $ hg debugdrawdag <<'EOS'
1696 > E D1 # rebase: D1 -> D2
1697 > | |
1698 > | C
1699 > D2 |
1700 > | B
1701 > |/
1702 > A
1703 > EOS
1704 $ hg update D1 -q
1705 $ hg bookmark book -i
1706 $ hg rebase -r B+D1 -d E
1707 rebasing 1:112478962961 B "B"
1708 note: not rebasing 5:15ecf15e0114 book D1 tip "D1", already in destination as 2:0807738e0be9 D2 "D2"
1709 1 new orphan changesets
1710 $ hg log -G -T '{desc} {bookmarks}'
1711 @ B book
1712 |
1713 | x D1
1714 | |
1715 o | E
1716 | |
1717 | * C
1718 | |
1719 o | D2
1720 | |
1721 | x B
1722 |/
1723 o A
1724
1725 Rebasing a merge with one of its parent having a hidden successor
1726
1727 $ hg init $TESTTMP/merge-p1-hidden-successor
1728 $ cd $TESTTMP/merge-p1-hidden-successor
1729
1730 $ hg debugdrawdag <<'EOS'
1731 > E
1732 > |
1733 > B3 B2 # amend: B1 -> B2 -> B3
1734 > |/ # B2 is hidden
1735 > | D
1736 > | |\
1737 > | B1 C
1738 > |/
1739 > A
1740 > EOS
1741 1 new orphan changesets
1742
1743 $ eval `hg tags -T '{tag}={node}\n'`
1744 $ rm .hg/localtags
1745
1746 $ hg rebase -r $D -d $E
1747 rebasing 5:9e62094e4d94 "D"
1748
1749 $ hg log -G
1750 o 7:a699d059adcf D
1751 |\
1752 | o 6:ecc93090a95c E
1753 | |
1754 | o 4:0dc878468a23 B3
1755 | |
1756 o | 1:96cc3511f894 C
1757 /
1758 o 0:426bada5c675 A
1759
1760 For some reasons (--hidden, rebaseskipobsolete=0, directaccess, etc.),
1761 rebasestate may contain hidden hashes. "rebase --abort" should work regardless.
1762
1763 $ hg init $TESTTMP/hidden-state1
1764 $ cd $TESTTMP/hidden-state1
1765 $ cat >> .hg/hgrc <<EOF
1766 > [experimental]
1767 > rebaseskipobsolete=0
1768 > EOF
1769
1770 $ hg debugdrawdag <<'EOS'
1771 > C
1772 > |
1773 > D B # prune: B, C
1774 > |/ # B/D=B
1775 > A
1776 > EOS
1777
1778 $ eval `hg tags -T '{tag}={node}\n'`
1779 $ rm .hg/localtags
1780
1781 $ hg update -q $C --hidden
1782 updated to hidden changeset 7829726be4dc
1783 (hidden revision '7829726be4dc' is pruned)
1784 $ hg rebase -s $B -d $D
1785 rebasing 1:2ec65233581b "B"
1786 merging D
1787 warning: conflicts while merging D! (edit, then use 'hg resolve --mark')
1788 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1789 [240]
1790
1791 $ cp -R . $TESTTMP/hidden-state2
1792
1793 $ hg log -G
1794 @ 2:b18e25de2cf5 D
1795 |
1796 | % 1:2ec65233581b B (pruned using prune)
1797 |/
1798 o 0:426bada5c675 A
1799
1800 $ hg summary
1801 parent: 2:b18e25de2cf5 tip
1802 D
1803 branch: default
1804 commit: 1 modified, 1 added, 1 unknown, 1 unresolved
1805 update: 1 new changesets, 2 branch heads (merge)
1806 phases: 3 draft
1807 rebase: 0 rebased, 2 remaining (rebase --continue)
1808
1809 $ hg rebase --abort
1810 rebase aborted
1811
1812 Also test --continue for the above case
1813
1814 $ cd $TESTTMP/hidden-state2
1815 $ hg resolve -m
1816 (no more unresolved files)
1817 continue: hg rebase --continue
1818 $ hg rebase --continue
1819 rebasing 1:2ec65233581b "B"
1820 rebasing 3:7829726be4dc tip "C"
1821 $ hg log -G
1822 @ 5:1964d5d5b547 C
1823 |
1824 o 4:68deb90c12a2 B
1825 |
1826 o 2:b18e25de2cf5 D
1827 |
1828 o 0:426bada5c675 A
1829
1830 ====================
1831 Test --stop option |
1832 ====================
1833 $ cd ..
1834 $ hg init rbstop
1835 $ cd rbstop
1836 $ echo a>a
1837 $ hg ci -Aqma
1838 $ echo b>b
1839 $ hg ci -Aqmb
1840 $ echo c>c
1841 $ hg ci -Aqmc
1842 $ echo d>d
1843 $ hg ci -Aqmd
1844 $ hg up 0 -q
1845 $ echo f>f
1846 $ hg ci -Aqmf
1847 $ echo D>d
1848 $ hg ci -Aqm "conflict with d"
1849 $ hg up 3 -q
1850 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1851 o 5:00bfc9898aeb test
1852 | conflict with d
1853 |
1854 o 4:dafd40200f93 test
1855 | f
1856 |
1857 | @ 3:055a42cdd887 test
1858 | | d
1859 | |
1860 | o 2:177f92b77385 test
1861 | | c
1862 | |
1863 | o 1:d2ae7f538514 test
1864 |/ b
1865 |
1866 o 0:cb9a9f314b8b test
1867 a
1868
1869 $ hg rebase -s 1 -d 5
1870 rebasing 1:d2ae7f538514 "b"
1871 rebasing 2:177f92b77385 "c"
1872 rebasing 3:055a42cdd887 "d"
1873 merging d
1874 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1875 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1876 [240]
1877 $ hg rebase --stop
1878 1 new orphan changesets
1879 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1880 o 7:7fffad344617 test
1881 | c
1882 |
1883 o 6:b15528633407 test
1884 | b
1885 |
1886 o 5:00bfc9898aeb test
1887 | conflict with d
1888 |
1889 o 4:dafd40200f93 test
1890 | f
1891 |
1892 | @ 3:055a42cdd887 test
1893 | | d
1894 | |
1895 | x 2:177f92b77385 test
1896 | | c
1897 | |
1898 | x 1:d2ae7f538514 test
1899 |/ b
1900 |
1901 o 0:cb9a9f314b8b test
1902 a
1903
1904 Test it aborts if unstable csets is not allowed:
1905 ===============================================
1906 $ cat >> $HGRCPATH << EOF
1907 > [experimental]
1908 > evolution.allowunstable=False
1909 > EOF
1910
1911 $ hg strip 6 --no-backup -q
1912 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1913 o 5:00bfc9898aeb test
1914 | conflict with d
1915 |
1916 o 4:dafd40200f93 test
1917 | f
1918 |
1919 | @ 3:055a42cdd887 test
1920 | | d
1921 | |
1922 | o 2:177f92b77385 test
1923 | | c
1924 | |
1925 | o 1:d2ae7f538514 test
1926 |/ b
1927 |
1928 o 0:cb9a9f314b8b test
1929 a
1930
1931 $ hg rebase -s 1 -d 5
1932 rebasing 1:d2ae7f538514 "b"
1933 rebasing 2:177f92b77385 "c"
1934 rebasing 3:055a42cdd887 "d"
1935 merging d
1936 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1937 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1938 [240]
1939 $ hg rebase --stop
1940 abort: cannot remove original changesets with unrebased descendants
1941 (either enable obsmarkers to allow unstable revisions or use --keep to keep original changesets)
1942 [20]
1943 $ hg rebase --abort
1944 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1945 rebase aborted
1946
1947 Test --stop when --keep is passed:
1948 ==================================
1949 $ hg rebase -s 1 -d 5 --keep
1950 rebasing 1:d2ae7f538514 "b"
1951 rebasing 2:177f92b77385 "c"
1952 rebasing 3:055a42cdd887 "d"
1953 merging d
1954 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1955 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1956 [240]
1957 $ hg rebase --stop
1958 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1959 o 7:7fffad344617 test
1960 | c
1961 |
1962 o 6:b15528633407 test
1963 | b
1964 |
1965 o 5:00bfc9898aeb test
1966 | conflict with d
1967 |
1968 o 4:dafd40200f93 test
1969 | f
1970 |
1971 | @ 3:055a42cdd887 test
1972 | | d
1973 | |
1974 | o 2:177f92b77385 test
1975 | | c
1976 | |
1977 | o 1:d2ae7f538514 test
1978 |/ b
1979 |
1980 o 0:cb9a9f314b8b test
1981 a
1982
1983 Test --stop aborts when --collapse was passed:
1984 =============================================
1985 $ cat >> $HGRCPATH << EOF
1986 > [experimental]
1987 > evolution.allowunstable=True
1988 > EOF
1989
1990 $ hg strip 6
1991 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1992 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1993 o 5:00bfc9898aeb test
1994 | conflict with d
1995 |
1996 o 4:dafd40200f93 test
1997 | f
1998 |
1999 | @ 3:055a42cdd887 test
2000 | | d
2001 | |
2002 | o 2:177f92b77385 test
2003 | | c
2004 | |
2005 | o 1:d2ae7f538514 test
2006 |/ b
2007 |
2008 o 0:cb9a9f314b8b test
2009 a
2010
2011 $ hg rebase -s 1 -d 5 --collapse -m "collapsed b c d"
2012 rebasing 1:d2ae7f538514 "b"
2013 rebasing 2:177f92b77385 "c"
2014 rebasing 3:055a42cdd887 "d"
2015 merging d
2016 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2017 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2018 [240]
2019 $ hg rebase --stop
2020 abort: cannot stop in --collapse session
2021 [20]
2022 $ hg rebase --abort
2023 rebase aborted
2024 $ hg diff
2025 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
2026 o 5:00bfc9898aeb test
2027 | conflict with d
2028 |
2029 o 4:dafd40200f93 test
2030 | f
2031 |
2032 | @ 3:055a42cdd887 test
2033 | | d
2034 | |
2035 | o 2:177f92b77385 test
2036 | | c
2037 | |
2038 | o 1:d2ae7f538514 test
2039 |/ b
2040 |
2041 o 0:cb9a9f314b8b test
2042 a
2043
2044 Test --stop raise errors with conflicting options:
2045 =================================================
2046 $ hg rebase -s 3 -d 5
2047 rebasing 3:055a42cdd887 "d"
2048 merging d
2049 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2050 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2051 [240]
2052 $ hg rebase --stop --dry-run
2053 abort: cannot specify both --stop and --dry-run
2054 [10]
2055
2056 $ hg rebase -s 3 -d 5
2057 abort: rebase in progress
2058 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
2059 [20]
2060 $ hg rebase --stop --continue
2061 abort: cannot specify both --stop and --continue
2062 [10]
2063
2064 Test --stop moves bookmarks of original revisions to new rebased nodes:
2065 ======================================================================
2066 $ cd ..
2067 $ hg init repo
2068 $ cd repo
2069
2070 $ echo a > a
2071 $ hg ci -Am A
2072 adding a
2073
2074 $ echo b > b
2075 $ hg ci -Am B
2076 adding b
2077 $ hg book X
2078 $ hg book Y
2079
2080 $ echo c > c
2081 $ hg ci -Am C
2082 adding c
2083 $ hg book Z
2084
2085 $ echo d > d
2086 $ hg ci -Am D
2087 adding d
2088
2089 $ hg up 0 -q
2090 $ echo e > e
2091 $ hg ci -Am E
2092 adding e
2093 created new head
2094
2095 $ echo doubt > d
2096 $ hg ci -Am "conflict with d"
2097 adding d
2098
2099 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2100 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2101 |
2102 o 4: 9c1e55f411b6 'E' bookmarks:
2103 |
2104 | o 3: 67a385d4e6f2 'D' bookmarks: Z
2105 | |
2106 | o 2: 49cb3485fa0c 'C' bookmarks: Y
2107 | |
2108 | o 1: 6c81ed0049f8 'B' bookmarks: X
2109 |/
2110 o 0: 1994f17a630e 'A' bookmarks:
2111
2112 $ hg rebase -s 1 -d 5
2113 rebasing 1:6c81ed0049f8 X "B"
2114 rebasing 2:49cb3485fa0c Y "C"
2115 rebasing 3:67a385d4e6f2 Z "D"
2116 merging d
2117 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2118 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2119 [240]
2120 $ hg rebase --stop
2121 1 new orphan changesets
2122 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2123 o 7: 9c86c650b686 'C' bookmarks: Y
2124 |
2125 o 6: 9b87b54e5fd8 'B' bookmarks: X
2126 |
2127 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2128 |
2129 o 4: 9c1e55f411b6 'E' bookmarks:
2130 |
2131 | * 3: 67a385d4e6f2 'D' bookmarks: Z
2132 | |
2133 | x 2: 49cb3485fa0c 'C' bookmarks:
2134 | |
2135 | x 1: 6c81ed0049f8 'B' bookmarks:
2136 |/
2137 o 0: 1994f17a630e 'A' bookmarks:
2138
This diff has been collapsed as it changes many lines, (1819 lines changed) Show them Hide them
@@ -18,732 +18,6 b' Enable obsolete'
18 > strip=
18 > strip=
19 > EOF
19 > EOF
20
20
21 Setup rebase canonical repo
22
23 $ hg init base
24 $ cd base
25 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
26 adding changesets
27 adding manifests
28 adding file changes
29 added 8 changesets with 7 changes to 7 files (+2 heads)
30 new changesets cd010b8cd998:02de42196ebe (8 drafts)
31 (run 'hg heads' to see heads, 'hg merge' to merge)
32 $ hg up tip
33 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ hg log -G
35 @ 7:02de42196ebe H
36 |
37 | o 6:eea13746799a G
38 |/|
39 o | 5:24b6387c8c8c F
40 | |
41 | o 4:9520eea781bc E
42 |/
43 | o 3:32af7686d403 D
44 | |
45 | o 2:5fddd98957c8 C
46 | |
47 | o 1:42ccdea3bb16 B
48 |/
49 o 0:cd010b8cd998 A
50
51 $ cd ..
52
53 simple rebase
54 ---------------------------------
55
56 $ hg clone base simple
57 updating to branch default
58 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 $ cd simple
60 $ hg up 32af7686d403
61 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
62 $ hg rebase -d eea13746799a
63 rebasing 1:42ccdea3bb16 "B"
64 rebasing 2:5fddd98957c8 "C"
65 rebasing 3:32af7686d403 "D"
66 $ hg log -G
67 @ 10:8eeb3c33ad33 D
68 |
69 o 9:2327fea05063 C
70 |
71 o 8:e4e5be0395b2 B
72 |
73 | o 7:02de42196ebe H
74 | |
75 o | 6:eea13746799a G
76 |\|
77 | o 5:24b6387c8c8c F
78 | |
79 o | 4:9520eea781bc E
80 |/
81 o 0:cd010b8cd998 A
82
83 $ hg log --hidden -G
84 @ 10:8eeb3c33ad33 D
85 |
86 o 9:2327fea05063 C
87 |
88 o 8:e4e5be0395b2 B
89 |
90 | o 7:02de42196ebe H
91 | |
92 o | 6:eea13746799a G
93 |\|
94 | o 5:24b6387c8c8c F
95 | |
96 o | 4:9520eea781bc E
97 |/
98 | x 3:32af7686d403 D (rewritten using rebase as 10:8eeb3c33ad33)
99 | |
100 | x 2:5fddd98957c8 C (rewritten using rebase as 9:2327fea05063)
101 | |
102 | x 1:42ccdea3bb16 B (rewritten using rebase as 8:e4e5be0395b2)
103 |/
104 o 0:cd010b8cd998 A
105
106 $ hg debugobsolete
107 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
108 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
109 32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
110
111
112 $ cd ..
113
114 empty changeset
115 ---------------------------------
116
117 $ hg clone base empty
118 updating to branch default
119 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 $ cd empty
121 $ hg up eea13746799a
122 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
123
124 We make a copy of both the first changeset in the rebased and some other in the
125 set.
126
127 $ hg graft 42ccdea3bb16 32af7686d403
128 grafting 1:42ccdea3bb16 "B"
129 grafting 3:32af7686d403 "D"
130 $ hg rebase -s 42ccdea3bb16 -d .
131 rebasing 1:42ccdea3bb16 "B"
132 note: not rebasing 1:42ccdea3bb16 "B", its destination already has all its changes
133 rebasing 2:5fddd98957c8 "C"
134 rebasing 3:32af7686d403 "D"
135 note: not rebasing 3:32af7686d403 "D", its destination already has all its changes
136 $ hg log -G
137 o 10:5ae4c968c6ac C
138 |
139 @ 9:08483444fef9 D
140 |
141 o 8:8877864f1edb B
142 |
143 | o 7:02de42196ebe H
144 | |
145 o | 6:eea13746799a G
146 |\|
147 | o 5:24b6387c8c8c F
148 | |
149 o | 4:9520eea781bc E
150 |/
151 o 0:cd010b8cd998 A
152
153 $ hg log --hidden -G
154 o 10:5ae4c968c6ac C
155 |
156 @ 9:08483444fef9 D
157 |
158 o 8:8877864f1edb B
159 |
160 | o 7:02de42196ebe H
161 | |
162 o | 6:eea13746799a G
163 |\|
164 | o 5:24b6387c8c8c F
165 | |
166 o | 4:9520eea781bc E
167 |/
168 | x 3:32af7686d403 D (pruned using rebase)
169 | |
170 | x 2:5fddd98957c8 C (rewritten using rebase as 10:5ae4c968c6ac)
171 | |
172 | x 1:42ccdea3bb16 B (pruned using rebase)
173 |/
174 o 0:cd010b8cd998 A
175
176 $ hg debugobsolete
177 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
178 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
179 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
180
181
182 More complex case where part of the rebase set were already rebased
183
184 $ hg rebase --rev 'desc(D)' --dest 'desc(H)'
185 rebasing 9:08483444fef9 "D"
186 1 new orphan changesets
187 $ hg debugobsolete
188 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
189 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
190 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
191 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
192 $ hg log -G
193 @ 11:4596109a6a43 D
194 |
195 | * 10:5ae4c968c6ac C
196 | |
197 | x 9:08483444fef9 D (rewritten using rebase as 11:4596109a6a43)
198 | |
199 | o 8:8877864f1edb B
200 | |
201 o | 7:02de42196ebe H
202 | |
203 | o 6:eea13746799a G
204 |/|
205 o | 5:24b6387c8c8c F
206 | |
207 | o 4:9520eea781bc E
208 |/
209 o 0:cd010b8cd998 A
210
211 $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True
212 rebasing 8:8877864f1edb "B"
213 note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 tip "D"
214 rebasing 10:5ae4c968c6ac "C"
215 $ hg debugobsolete
216 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
217 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
218 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
219 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
220 8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
221 5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
222 $ hg log --rev 'contentdivergent()'
223 $ hg log -G
224 o 13:98f6af4ee953 C
225 |
226 o 12:462a34d07e59 B
227 |
228 @ 11:4596109a6a43 D
229 |
230 o 7:02de42196ebe H
231 |
232 | o 6:eea13746799a G
233 |/|
234 o | 5:24b6387c8c8c F
235 | |
236 | o 4:9520eea781bc E
237 |/
238 o 0:cd010b8cd998 A
239
240 $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003
241 changeset: 11:4596109a6a4328c398bde3a4a3b6737cfade3003
242 phase: draft
243 parent: 7:02de42196ebee42ef284b6780a87cdc96e8eaab6
244 parent: -1:0000000000000000000000000000000000000000
245 manifest: 11:a91006e3a02f1edf631f7018e6e5684cf27dd905
246 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
247 date: Sat Apr 30 15:24:48 2011 +0200
248 files+: D
249 extra: branch=default
250 extra: rebase_source=08483444fef91d6224f6655ee586a65d263ad34c
251 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
252 description:
253 D
254
255
256 $ hg up -qr 'desc(G)'
257 $ hg graft 4596109a6a4328c398bde3a4a3b6737cfade3003
258 grafting 11:4596109a6a43 "D"
259 $ hg up -qr 'desc(E)'
260 $ hg rebase -s tip -d .
261 rebasing 14:9e36056a46e3 tip "D"
262 $ hg log --style default --debug -r tip
263 changeset: 15:627d4614809036ba22b9e7cb31638ddc06ab99ab
264 tag: tip
265 phase: draft
266 parent: 4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba
267 parent: -1:0000000000000000000000000000000000000000
268 manifest: 15:648e8ede73ae3e497d093d3a4c8fcc2daa864f42
269 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
270 date: Sat Apr 30 15:24:48 2011 +0200
271 files+: D
272 extra: branch=default
273 extra: intermediate-source=4596109a6a4328c398bde3a4a3b6737cfade3003
274 extra: rebase_source=9e36056a46e37c9776168c7375734eebc70e294f
275 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
276 description:
277 D
278
279
280 Start rebase from a commit that is obsolete but not hidden only because it's
281 a working copy parent. We should be moved back to the starting commit as usual
282 even though it is hidden (until we're moved there).
283
284 $ hg --hidden up -qr 'first(hidden())'
285 updated to hidden changeset 42ccdea3bb16
286 (hidden revision '42ccdea3bb16' is pruned)
287 $ hg rebase --rev 13 --dest 15
288 rebasing 13:98f6af4ee953 "C"
289 $ hg log -G
290 o 16:294a2b93eb4d C
291 |
292 o 15:627d46148090 D
293 |
294 | o 12:462a34d07e59 B
295 | |
296 | o 11:4596109a6a43 D
297 | |
298 | o 7:02de42196ebe H
299 | |
300 +---o 6:eea13746799a G
301 | |/
302 | o 5:24b6387c8c8c F
303 | |
304 o | 4:9520eea781bc E
305 |/
306 | @ 1:42ccdea3bb16 B (pruned using rebase)
307 |/
308 o 0:cd010b8cd998 A
309
310
311 $ cd ..
312
313 collapse rebase
314 ---------------------------------
315
316 $ hg clone base collapse
317 updating to branch default
318 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
319 $ cd collapse
320 $ hg rebase -s 42ccdea3bb16 -d eea13746799a --collapse
321 rebasing 1:42ccdea3bb16 "B"
322 rebasing 2:5fddd98957c8 "C"
323 rebasing 3:32af7686d403 "D"
324 $ hg log -G
325 o 8:4dc2197e807b Collapsed revision
326 |
327 | @ 7:02de42196ebe H
328 | |
329 o | 6:eea13746799a G
330 |\|
331 | o 5:24b6387c8c8c F
332 | |
333 o | 4:9520eea781bc E
334 |/
335 o 0:cd010b8cd998 A
336
337 $ hg log --hidden -G
338 o 8:4dc2197e807b Collapsed revision
339 |
340 | @ 7:02de42196ebe H
341 | |
342 o | 6:eea13746799a G
343 |\|
344 | o 5:24b6387c8c8c F
345 | |
346 o | 4:9520eea781bc E
347 |/
348 | x 3:32af7686d403 D (rewritten using rebase as 8:4dc2197e807b)
349 | |
350 | x 2:5fddd98957c8 C (rewritten using rebase as 8:4dc2197e807b)
351 | |
352 | x 1:42ccdea3bb16 B (rewritten using rebase as 8:4dc2197e807b)
353 |/
354 o 0:cd010b8cd998 A
355
356 $ hg id --debug -r tip
357 4dc2197e807bae9817f09905b50ab288be2dbbcf tip
358 $ hg debugobsolete
359 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '1', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
360 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '2', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
361 32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '3', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
362
363 $ cd ..
364
365 Rebase set has hidden descendants
366 ---------------------------------
367
368 We rebase a changeset which has hidden descendants. Hidden changesets must not
369 be rebased.
370
371 $ hg clone base hidden
372 updating to branch default
373 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
374 $ cd hidden
375 $ hg log -G
376 @ 7:02de42196ebe H
377 |
378 | o 6:eea13746799a G
379 |/|
380 o | 5:24b6387c8c8c F
381 | |
382 | o 4:9520eea781bc E
383 |/
384 | o 3:32af7686d403 D
385 | |
386 | o 2:5fddd98957c8 C
387 | |
388 | o 1:42ccdea3bb16 B
389 |/
390 o 0:cd010b8cd998 A
391
392 $ hg rebase -s 5fddd98957c8 -d eea13746799a
393 rebasing 2:5fddd98957c8 "C"
394 rebasing 3:32af7686d403 "D"
395 $ hg log -G
396 o 9:cf44d2f5a9f4 D
397 |
398 o 8:e273c5e7d2d2 C
399 |
400 | @ 7:02de42196ebe H
401 | |
402 o | 6:eea13746799a G
403 |\|
404 | o 5:24b6387c8c8c F
405 | |
406 o | 4:9520eea781bc E
407 |/
408 | o 1:42ccdea3bb16 B
409 |/
410 o 0:cd010b8cd998 A
411
412 $ hg rebase -s 42ccdea3bb16 -d 02de42196ebe
413 rebasing 1:42ccdea3bb16 "B"
414 $ hg log -G
415 o 10:7c6027df6a99 B
416 |
417 | o 9:cf44d2f5a9f4 D
418 | |
419 | o 8:e273c5e7d2d2 C
420 | |
421 @ | 7:02de42196ebe H
422 | |
423 | o 6:eea13746799a G
424 |/|
425 o | 5:24b6387c8c8c F
426 | |
427 | o 4:9520eea781bc E
428 |/
429 o 0:cd010b8cd998 A
430
431 $ hg log --hidden -G
432 o 10:7c6027df6a99 B
433 |
434 | o 9:cf44d2f5a9f4 D
435 | |
436 | o 8:e273c5e7d2d2 C
437 | |
438 @ | 7:02de42196ebe H
439 | |
440 | o 6:eea13746799a G
441 |/|
442 o | 5:24b6387c8c8c F
443 | |
444 | o 4:9520eea781bc E
445 |/
446 | x 3:32af7686d403 D (rewritten using rebase as 9:cf44d2f5a9f4)
447 | |
448 | x 2:5fddd98957c8 C (rewritten using rebase as 8:e273c5e7d2d2)
449 | |
450 | x 1:42ccdea3bb16 B (rewritten using rebase as 10:7c6027df6a99)
451 |/
452 o 0:cd010b8cd998 A
453
454 $ hg debugobsolete
455 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
456 32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
457 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
458
459 Test that rewriting leaving instability behind is allowed
460 ---------------------------------------------------------------------
461
462 $ hg log -r 'children(8)'
463 9:cf44d2f5a9f4 D (no-eol)
464 $ hg rebase -r 8
465 rebasing 8:e273c5e7d2d2 "C"
466 1 new orphan changesets
467 $ hg log -G
468 o 11:0d8f238b634c C
469 |
470 o 10:7c6027df6a99 B
471 |
472 | * 9:cf44d2f5a9f4 D
473 | |
474 | x 8:e273c5e7d2d2 C (rewritten using rebase as 11:0d8f238b634c)
475 | |
476 @ | 7:02de42196ebe H
477 | |
478 | o 6:eea13746799a G
479 |/|
480 o | 5:24b6387c8c8c F
481 | |
482 | o 4:9520eea781bc E
483 |/
484 o 0:cd010b8cd998 A
485
486 $ cd ..
487 $ cp -R hidden stabilize
488 $ cd stabilize
489 $ hg rebase --auto-orphans '0::' -d 10
490 abort: cannot specify both --auto-orphans and --dest
491 [10]
492 $ hg rebase --auto-orphans '0::'
493 rebasing 9:cf44d2f5a9f4 "D"
494 $ hg log -G
495 o 12:7e3935feaa68 D
496 |
497 o 11:0d8f238b634c C
498 |
499 o 10:7c6027df6a99 B
500 |
501 @ 7:02de42196ebe H
502 |
503 | o 6:eea13746799a G
504 |/|
505 o | 5:24b6387c8c8c F
506 | |
507 | o 4:9520eea781bc E
508 |/
509 o 0:cd010b8cd998 A
510
511
512 $ cd ../hidden
513 $ rm -r ../stabilize
514
515 Test multiple root handling
516 ------------------------------------
517
518 $ hg rebase --dest 4 --rev '7+11+9'
519 rebasing 9:cf44d2f5a9f4 "D"
520 rebasing 7:02de42196ebe "H"
521 rebasing 11:0d8f238b634c tip "C"
522 $ hg log -G
523 o 14:1e8370e38cca C
524 |
525 @ 13:bfe264faf697 H
526 |
527 | o 12:102b4c1d889b D
528 |/
529 | * 10:7c6027df6a99 B
530 | |
531 | x 7:02de42196ebe H (rewritten using rebase as 13:bfe264faf697)
532 | |
533 +---o 6:eea13746799a G
534 | |/
535 | o 5:24b6387c8c8c F
536 | |
537 o | 4:9520eea781bc E
538 |/
539 o 0:cd010b8cd998 A
540
541 $ cd ..
542
543 Detach both parents
544
545 $ hg init double-detach
546 $ cd double-detach
547
548 $ hg debugdrawdag <<EOF
549 > F
550 > /|
551 > C E
552 > | |
553 > B D G
554 > \|/
555 > A
556 > EOF
557
558 $ hg rebase -d G -r 'B + D + F'
559 rebasing 1:112478962961 B "B"
560 rebasing 2:b18e25de2cf5 D "D"
561 rebasing 6:f15c3adaf214 F tip "F"
562 abort: cannot rebase 6:f15c3adaf214 without moving at least one of its parents
563 [10]
564
565 $ cd ..
566
567 test on rebase dropping a merge
568
569 (setup)
570
571 $ hg init dropmerge
572 $ cd dropmerge
573 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
574 adding changesets
575 adding manifests
576 adding file changes
577 added 8 changesets with 7 changes to 7 files (+2 heads)
578 new changesets cd010b8cd998:02de42196ebe (8 drafts)
579 (run 'hg heads' to see heads, 'hg merge' to merge)
580 $ hg up 3
581 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
582 $ hg merge 7
583 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
584 (branch merge, don't forget to commit)
585 $ hg ci -m 'M'
586 $ echo I > I
587 $ hg add I
588 $ hg ci -m I
589 $ hg log -G
590 @ 9:4bde274eefcf I
591 |
592 o 8:53a6a128b2b7 M
593 |\
594 | o 7:02de42196ebe H
595 | |
596 | | o 6:eea13746799a G
597 | |/|
598 | o | 5:24b6387c8c8c F
599 | | |
600 | | o 4:9520eea781bc E
601 | |/
602 o | 3:32af7686d403 D
603 | |
604 o | 2:5fddd98957c8 C
605 | |
606 o | 1:42ccdea3bb16 B
607 |/
608 o 0:cd010b8cd998 A
609
610 (actual test)
611
612 $ hg rebase --dest 6 --rev '((desc(H) + desc(D))::) - desc(M)'
613 rebasing 3:32af7686d403 "D"
614 rebasing 7:02de42196ebe "H"
615 rebasing 9:4bde274eefcf tip "I"
616 1 new orphan changesets
617 $ hg log -G
618 @ 12:acd174b7ab39 I
619 |
620 o 11:6c11a6218c97 H
621 |
622 | o 10:b5313c85b22e D
623 |/
624 | * 8:53a6a128b2b7 M
625 | |\
626 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
627 | | |
628 o---+ 6:eea13746799a G
629 | | |
630 | | o 5:24b6387c8c8c F
631 | | |
632 o---+ 4:9520eea781bc E
633 / /
634 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
635 | |
636 o | 2:5fddd98957c8 C
637 | |
638 o | 1:42ccdea3bb16 B
639 |/
640 o 0:cd010b8cd998 A
641
642
643 Test hidden changesets in the rebase set (issue4504)
644
645 $ hg up --hidden 9
646 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
647 updated to hidden changeset 4bde274eefcf
648 (hidden revision '4bde274eefcf' was rewritten as: acd174b7ab39)
649 $ echo J > J
650 $ hg add J
651 $ hg commit -m J
652 1 new orphan changesets
653 $ hg debugobsolete `hg log --rev . -T '{node}'`
654 1 new obsolescence markers
655 obsoleted 1 changesets
656
657 $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback --config experimental.rebaseskipobsolete=off
658 rebasing 9:4bde274eefcf "I"
659 rebasing 13:06edfc82198f tip "J"
660 2 new content-divergent changesets
661 $ hg log -G
662 @ 15:5ae8a643467b J
663 |
664 * 14:9ad579b4a5de I
665 |
666 | * 12:acd174b7ab39 I
667 | |
668 | o 11:6c11a6218c97 H
669 | |
670 o | 10:b5313c85b22e D
671 |/
672 | * 8:53a6a128b2b7 M
673 | |\
674 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
675 | | |
676 o---+ 6:eea13746799a G
677 | | |
678 | | o 5:24b6387c8c8c F
679 | | |
680 o---+ 4:9520eea781bc E
681 / /
682 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
683 | |
684 o | 2:5fddd98957c8 C
685 | |
686 o | 1:42ccdea3bb16 B
687 |/
688 o 0:cd010b8cd998 A
689
690 $ hg up 14 -C
691 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
692 $ echo "K" > K
693 $ hg add K
694 $ hg commit --amend -m "K"
695 1 new orphan changesets
696 $ echo "L" > L
697 $ hg add L
698 $ hg commit -m "L"
699 $ hg up '.^'
700 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
701 $ echo "M" > M
702 $ hg add M
703 $ hg commit --amend -m "M"
704 1 new orphan changesets
705 $ hg log -G
706 @ 18:bfaedf8eb73b M
707 |
708 | * 17:97219452e4bd L
709 | |
710 | x 16:fc37a630c901 K (rewritten using amend as 18:bfaedf8eb73b)
711 |/
712 | * 15:5ae8a643467b J
713 | |
714 | x 14:9ad579b4a5de I (rewritten using amend as 16:fc37a630c901)
715 |/
716 | * 12:acd174b7ab39 I
717 | |
718 | o 11:6c11a6218c97 H
719 | |
720 o | 10:b5313c85b22e D
721 |/
722 | * 8:53a6a128b2b7 M
723 | |\
724 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
725 | | |
726 o---+ 6:eea13746799a G
727 | | |
728 | | o 5:24b6387c8c8c F
729 | | |
730 o---+ 4:9520eea781bc E
731 / /
732 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
733 | |
734 o | 2:5fddd98957c8 C
735 | |
736 o | 1:42ccdea3bb16 B
737 |/
738 o 0:cd010b8cd998 A
739
740 $ hg rebase -s 14 -d 17 --config experimental.rebaseskipobsolete=True
741 note: not rebasing 14:9ad579b4a5de "I", already in destination as 16:fc37a630c901 "K"
742 rebasing 15:5ae8a643467b "J"
743 1 new orphan changesets
744
745 $ cd ..
746
747 Skip obsolete changeset even with multiple hops
21 Skip obsolete changeset even with multiple hops
748 -----------------------------------------------
22 -----------------------------------------------
749
23
@@ -1043,1096 +317,3 b' Create the changes that we will rebase'
1043 note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
317 note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
1044 rebasing 21:7bdc8a87673d tip "dummy change"
318 rebasing 21:7bdc8a87673d tip "dummy change"
1045 $ cd ..
319 $ cd ..
1046
1047 Divergence cases due to obsolete changesets
1048 -------------------------------------------
1049
1050 We should ignore branches with unstable changesets when they are based on an
1051 obsolete changeset which successor is in rebase set.
1052
1053 $ hg init divergence
1054 $ cd divergence
1055 $ cat >> .hg/hgrc << EOF
1056 > [extensions]
1057 > strip =
1058 > [alias]
1059 > strip = strip --no-backup --quiet
1060 > [templates]
1061 > instabilities = '{rev}:{node|short} {desc|firstline}{if(instabilities," ({instabilities})")}\n'
1062 > EOF
1063
1064 $ hg debugdrawdag <<EOF
1065 > e f
1066 > | |
1067 > d' d # replace: d -> d'
1068 > \ /
1069 > c
1070 > |
1071 > x b
1072 > \|
1073 > a
1074 > EOF
1075 1 new orphan changesets
1076 $ hg log -G -r 'a'::
1077 * 7:1143e9adc121 f
1078 |
1079 | o 6:d60ebfa0f1cb e
1080 | |
1081 | o 5:027ad6c5830d d'
1082 | |
1083 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1084 |/
1085 o 3:a82ac2b38757 c
1086 |
1087 | o 2:630d7c95eff7 x
1088 | |
1089 o | 1:488e1b7e7341 b
1090 |/
1091 o 0:b173517d0057 a
1092
1093
1094 Changeset d and its descendants are excluded to avoid divergence of d, which
1095 would occur because the successor of d (d') is also in rebaseset. As a
1096 consequence f (descendant of d) is left behind.
1097
1098 $ hg rebase -b 'e' -d 'x'
1099 rebasing 1:488e1b7e7341 b "b"
1100 rebasing 3:a82ac2b38757 c "c"
1101 rebasing 5:027ad6c5830d d' "d'"
1102 rebasing 6:d60ebfa0f1cb e "e"
1103 note: not rebasing 4:76be324c128b d "d" and its descendants as this would cause divergence
1104 $ hg log -G -r 'a'::
1105 o 11:eb6d63fc4ed5 e
1106 |
1107 o 10:44d8c724a70c d'
1108 |
1109 o 9:d008e6b4d3fd c
1110 |
1111 o 8:67e8f4a16c49 b
1112 |
1113 | * 7:1143e9adc121 f
1114 | |
1115 | | x 6:d60ebfa0f1cb e (rewritten using rebase as 11:eb6d63fc4ed5)
1116 | | |
1117 | | x 5:027ad6c5830d d' (rewritten using rebase as 10:44d8c724a70c)
1118 | | |
1119 | x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1120 | |/
1121 | x 3:a82ac2b38757 c (rewritten using rebase as 9:d008e6b4d3fd)
1122 | |
1123 o | 2:630d7c95eff7 x
1124 | |
1125 | x 1:488e1b7e7341 b (rewritten using rebase as 8:67e8f4a16c49)
1126 |/
1127 o 0:b173517d0057 a
1128
1129 $ hg strip -r 8:
1130 $ hg log -G -r 'a'::
1131 * 7:1143e9adc121 f
1132 |
1133 | o 6:d60ebfa0f1cb e
1134 | |
1135 | o 5:027ad6c5830d d'
1136 | |
1137 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1138 |/
1139 o 3:a82ac2b38757 c
1140 |
1141 | o 2:630d7c95eff7 x
1142 | |
1143 o | 1:488e1b7e7341 b
1144 |/
1145 o 0:b173517d0057 a
1146
1147
1148 If the rebase set has an obsolete (d) with a successor (d') outside the rebase
1149 set and none in destination, we still get the divergence warning.
1150 By allowing divergence, we can perform the rebase.
1151
1152 $ hg rebase -r 'c'::'f' -d 'x'
1153 abort: this rebase will cause divergences from: 76be324c128b
1154 (to force the rebase please set experimental.evolution.allowdivergence=True)
1155 [20]
1156 $ hg rebase --config experimental.evolution.allowdivergence=true -r 'c'::'f' -d 'x'
1157 rebasing 3:a82ac2b38757 c "c"
1158 rebasing 4:76be324c128b d "d"
1159 rebasing 7:1143e9adc121 f tip "f"
1160 1 new orphan changesets
1161 2 new content-divergent changesets
1162 $ hg log -G -r 'a':: -T instabilities
1163 o 10:e1744ea07510 f
1164 |
1165 * 9:e2b36ea9a0a0 d (content-divergent)
1166 |
1167 o 8:6a0376de376e c
1168 |
1169 | x 7:1143e9adc121 f
1170 | |
1171 | | * 6:d60ebfa0f1cb e (orphan)
1172 | | |
1173 | | * 5:027ad6c5830d d' (orphan content-divergent)
1174 | | |
1175 | x | 4:76be324c128b d
1176 | |/
1177 | x 3:a82ac2b38757 c
1178 | |
1179 o | 2:630d7c95eff7 x
1180 | |
1181 | o 1:488e1b7e7341 b
1182 |/
1183 o 0:b173517d0057 a
1184
1185 $ hg strip -r 8:
1186
1187 (Not skipping obsoletes means that divergence is allowed.)
1188
1189 $ hg rebase --config experimental.rebaseskipobsolete=false -r 'c'::'f' -d 'x'
1190 rebasing 3:a82ac2b38757 c "c"
1191 rebasing 4:76be324c128b d "d"
1192 rebasing 7:1143e9adc121 f tip "f"
1193 1 new orphan changesets
1194 2 new content-divergent changesets
1195
1196 $ hg strip -r 0:
1197
1198 Similar test on a more complex graph
1199
1200 $ hg debugdrawdag <<EOF
1201 > g
1202 > |
1203 > f e
1204 > | |
1205 > e' d # replace: e -> e'
1206 > \ /
1207 > c
1208 > |
1209 > x b
1210 > \|
1211 > a
1212 > EOF
1213 1 new orphan changesets
1214 $ hg log -G -r 'a':
1215 * 8:2876ce66c6eb g
1216 |
1217 | o 7:3ffec603ab53 f
1218 | |
1219 x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1220 | |
1221 | o 5:63324dc512ea e'
1222 | |
1223 o | 4:76be324c128b d
1224 |/
1225 o 3:a82ac2b38757 c
1226 |
1227 | o 2:630d7c95eff7 x
1228 | |
1229 o | 1:488e1b7e7341 b
1230 |/
1231 o 0:b173517d0057 a
1232
1233 $ hg rebase -b 'f' -d 'x'
1234 rebasing 1:488e1b7e7341 b "b"
1235 rebasing 3:a82ac2b38757 c "c"
1236 rebasing 5:63324dc512ea e' "e'"
1237 rebasing 7:3ffec603ab53 f "f"
1238 rebasing 4:76be324c128b d "d"
1239 note: not rebasing 6:e36fae928aec e "e" and its descendants as this would cause divergence
1240 $ hg log -G -r 'a':
1241 o 13:a1707a5b7c2c d
1242 |
1243 | o 12:ef6251596616 f
1244 | |
1245 | o 11:b6f172e64af9 e'
1246 |/
1247 o 10:d008e6b4d3fd c
1248 |
1249 o 9:67e8f4a16c49 b
1250 |
1251 | * 8:2876ce66c6eb g
1252 | |
1253 | | x 7:3ffec603ab53 f (rewritten using rebase as 12:ef6251596616)
1254 | | |
1255 | x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1256 | | |
1257 | | x 5:63324dc512ea e' (rewritten using rebase as 11:b6f172e64af9)
1258 | | |
1259 | x | 4:76be324c128b d (rewritten using rebase as 13:a1707a5b7c2c)
1260 | |/
1261 | x 3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd)
1262 | |
1263 o | 2:630d7c95eff7 x
1264 | |
1265 | x 1:488e1b7e7341 b (rewritten using rebase as 9:67e8f4a16c49)
1266 |/
1267 o 0:b173517d0057 a
1268
1269
1270 issue5782
1271 $ hg strip -r 0:
1272 $ hg debugdrawdag <<EOF
1273 > d
1274 > |
1275 > c1 c # replace: c -> c1
1276 > \ /
1277 > b
1278 > |
1279 > a
1280 > EOF
1281 1 new orphan changesets
1282 $ hg debugobsolete `hg log -T "{node}" --hidden -r 'desc("c1")'`
1283 1 new obsolescence markers
1284 obsoleted 1 changesets
1285 $ hg log -G -r 'a': --hidden
1286 * 4:76be324c128b d
1287 |
1288 | x 3:ef8a456de8fa c1 (pruned)
1289 | |
1290 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa)
1291 |/
1292 o 1:488e1b7e7341 b
1293 |
1294 o 0:b173517d0057 a
1295
1296 $ hg rebase -d 0 -r 2
1297 note: not rebasing 2:a82ac2b38757 c "c", it has no successor
1298 $ hg log -G -r 'a': --hidden
1299 * 4:76be324c128b d
1300 |
1301 | x 3:ef8a456de8fa c1 (pruned)
1302 | |
1303 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa)
1304 |/
1305 o 1:488e1b7e7341 b
1306 |
1307 o 0:b173517d0057 a
1308
1309 $ cd ..
1310
1311 Rebase merge where successor of one parent is equal to destination (issue5198)
1312
1313 $ hg init p1-succ-is-dest
1314 $ cd p1-succ-is-dest
1315
1316 $ hg debugdrawdag <<EOF
1317 > F
1318 > /|
1319 > E D B # replace: D -> B
1320 > \|/
1321 > A
1322 > EOF
1323 1 new orphan changesets
1324
1325 $ hg rebase -d B -s D
1326 note: not rebasing 2:b18e25de2cf5 D "D", already in destination as 1:112478962961 B "B"
1327 rebasing 4:66f1a38021c9 F tip "F"
1328 $ hg log -G
1329 o 5:50e9d60b99c6 F
1330 |\
1331 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:50e9d60b99c6)
1332 | |/|
1333 | o | 3:7fb047a69f22 E
1334 | | |
1335 | | x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1336 | |/
1337 o | 1:112478962961 B
1338 |/
1339 o 0:426bada5c675 A
1340
1341 $ cd ..
1342
1343 Rebase merge where successor of other parent is equal to destination
1344
1345 $ hg init p2-succ-is-dest
1346 $ cd p2-succ-is-dest
1347
1348 $ hg debugdrawdag <<EOF
1349 > F
1350 > /|
1351 > E D B # replace: E -> B
1352 > \|/
1353 > A
1354 > EOF
1355 1 new orphan changesets
1356
1357 $ hg rebase -d B -s E
1358 note: not rebasing 3:7fb047a69f22 E "E", already in destination as 1:112478962961 B "B"
1359 rebasing 4:66f1a38021c9 F tip "F"
1360 $ hg log -G
1361 o 5:aae1787dacee F
1362 |\
1363 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:aae1787dacee)
1364 | |/|
1365 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1366 | | |
1367 | o | 2:b18e25de2cf5 D
1368 | |/
1369 o / 1:112478962961 B
1370 |/
1371 o 0:426bada5c675 A
1372
1373 $ cd ..
1374
1375 Rebase merge where successor of one parent is ancestor of destination
1376
1377 $ hg init p1-succ-in-dest
1378 $ cd p1-succ-in-dest
1379
1380 $ hg debugdrawdag <<EOF
1381 > F C
1382 > /| |
1383 > E D B # replace: D -> B
1384 > \|/
1385 > A
1386 > EOF
1387 1 new orphan changesets
1388
1389 $ hg rebase -d C -s D
1390 note: not rebasing 2:b18e25de2cf5 D "D", already in destination as 1:112478962961 B "B"
1391 rebasing 5:66f1a38021c9 F tip "F"
1392
1393 $ hg log -G
1394 o 6:0913febf6439 F
1395 |\
1396 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:0913febf6439)
1397 | | |
1398 | o | 4:26805aba1e60 C
1399 | | |
1400 o | | 3:7fb047a69f22 E
1401 | | |
1402 +---x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1403 | |
1404 | o 1:112478962961 B
1405 |/
1406 o 0:426bada5c675 A
1407
1408 $ cd ..
1409
1410 Rebase merge where successor of other parent is ancestor of destination
1411
1412 $ hg init p2-succ-in-dest
1413 $ cd p2-succ-in-dest
1414
1415 $ hg debugdrawdag <<EOF
1416 > F C
1417 > /| |
1418 > E D B # replace: E -> B
1419 > \|/
1420 > A
1421 > EOF
1422 1 new orphan changesets
1423
1424 $ hg rebase -d C -s E
1425 note: not rebasing 3:7fb047a69f22 E "E", already in destination as 1:112478962961 B "B"
1426 rebasing 5:66f1a38021c9 F tip "F"
1427 $ hg log -G
1428 o 6:c6ab0cc6d220 F
1429 |\
1430 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:c6ab0cc6d220)
1431 | | |
1432 | o | 4:26805aba1e60 C
1433 | | |
1434 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1435 | | |
1436 o---+ 2:b18e25de2cf5 D
1437 / /
1438 o / 1:112478962961 B
1439 |/
1440 o 0:426bada5c675 A
1441
1442 $ cd ..
1443
1444 Rebase merge where successor of one parent is ancestor of destination
1445
1446 $ hg init p1-succ-in-dest-b
1447 $ cd p1-succ-in-dest-b
1448
1449 $ hg debugdrawdag <<EOF
1450 > F C
1451 > /| |
1452 > E D B # replace: E -> B
1453 > \|/
1454 > A
1455 > EOF
1456 1 new orphan changesets
1457
1458 $ hg rebase -d C -b F
1459 rebasing 2:b18e25de2cf5 D "D"
1460 note: not rebasing 3:7fb047a69f22 E "E", already in destination as 1:112478962961 B "B"
1461 rebasing 5:66f1a38021c9 F tip "F"
1462 note: not rebasing 5:66f1a38021c9 F tip "F", its destination already has all its changes
1463 $ hg log -G
1464 o 6:8f47515dda15 D
1465 |
1466 | x 5:66f1a38021c9 F (pruned using rebase)
1467 | |\
1468 o | | 4:26805aba1e60 C
1469 | | |
1470 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1471 | | |
1472 | x | 2:b18e25de2cf5 D (rewritten using rebase as 6:8f47515dda15)
1473 | |/
1474 o / 1:112478962961 B
1475 |/
1476 o 0:426bada5c675 A
1477
1478 $ cd ..
1479
1480 Rebase merge where successor of other parent is ancestor of destination
1481
1482 $ hg init p2-succ-in-dest-b
1483 $ cd p2-succ-in-dest-b
1484
1485 $ hg debugdrawdag <<EOF
1486 > F C
1487 > /| |
1488 > E D B # replace: D -> B
1489 > \|/
1490 > A
1491 > EOF
1492 1 new orphan changesets
1493
1494 $ hg rebase -d C -b F
1495 note: not rebasing 2:b18e25de2cf5 D "D", already in destination as 1:112478962961 B "B"
1496 rebasing 3:7fb047a69f22 E "E"
1497 rebasing 5:66f1a38021c9 F tip "F"
1498 note: not rebasing 5:66f1a38021c9 F tip "F", its destination already has all its changes
1499
1500 $ hg log -G
1501 o 6:533690786a86 E
1502 |
1503 | x 5:66f1a38021c9 F (pruned using rebase)
1504 | |\
1505 o | | 4:26805aba1e60 C
1506 | | |
1507 | | x 3:7fb047a69f22 E (rewritten using rebase as 6:533690786a86)
1508 | | |
1509 | x | 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1510 | |/
1511 o / 1:112478962961 B
1512 |/
1513 o 0:426bada5c675 A
1514
1515 $ cd ..
1516
1517 Rebase merge where extinct node has successor that is not an ancestor of
1518 destination
1519
1520 $ hg init extinct-with-succ-not-in-dest
1521 $ cd extinct-with-succ-not-in-dest
1522
1523 $ hg debugdrawdag <<EOF
1524 > E C # replace: C -> E
1525 > | |
1526 > D B
1527 > |/
1528 > A
1529 > EOF
1530
1531 $ hg rebase -d D -s B
1532 rebasing 1:112478962961 B "B"
1533 note: not rebasing 3:26805aba1e60 C "C" and its descendants as this would cause divergence
1534
1535 $ cd ..
1536
1537 $ hg init p2-succ-in-dest-c
1538 $ cd p2-succ-in-dest-c
1539
1540 The scenario here was that B::D were developed on default. B was queued on
1541 stable, but amended before being push to hg-committed. C was queued on default,
1542 along with unrelated J.
1543
1544 $ hg debugdrawdag <<EOF
1545 > J
1546 > |
1547 > F
1548 > |
1549 > E
1550 > | D
1551 > | |
1552 > | C # replace: C -> F
1553 > | | H I # replace: B -> H -> I
1554 > | B |/
1555 > |/ G
1556 > A
1557 > EOF
1558 1 new orphan changesets
1559
1560 This strip seems to be the key to avoid an early divergence warning.
1561 $ hg --config extensions.strip= --hidden strip -qr H
1562 1 new orphan changesets
1563
1564 $ hg rebase -b 'desc("D")' -d 'desc("J")'
1565 abort: this rebase will cause divergences from: 112478962961
1566 (to force the rebase please set experimental.evolution.allowdivergence=True)
1567 [20]
1568
1569 Rebase merge where both parents have successors in destination
1570
1571 $ hg init p12-succ-in-dest
1572 $ cd p12-succ-in-dest
1573 $ hg debugdrawdag <<'EOS'
1574 > E F
1575 > /| /| # replace: A -> C
1576 > A B C D # replace: B -> D
1577 > | |
1578 > X Y
1579 > EOS
1580 1 new orphan changesets
1581 $ hg rebase -r A+B+E -d F
1582 note: not rebasing 4:a3d17304151f A "A", already in destination as 0:96cc3511f894 C "C"
1583 note: not rebasing 5:b23a2cc00842 B "B", already in destination as 1:058c1e1fb10a D "D"
1584 rebasing 7:dac5d11c5a7d E tip "E"
1585 abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f
1586 [10]
1587 $ cd ..
1588
1589 Rebase a non-clean merge. One parent has successor in destination, the other
1590 parent moves as requested.
1591
1592 $ hg init p1-succ-p2-move
1593 $ cd p1-succ-p2-move
1594 $ hg debugdrawdag <<'EOS'
1595 > D Z
1596 > /| | # replace: A -> C
1597 > A B C # D/D = D
1598 > EOS
1599 1 new orphan changesets
1600 $ hg rebase -r A+B+D -d Z
1601 note: not rebasing 0:426bada5c675 A "A", already in destination as 2:96cc3511f894 C "C"
1602 rebasing 1:fc2b737bb2e5 B "B"
1603 rebasing 3:b8ed089c80ad D "D"
1604
1605 $ rm .hg/localtags
1606 $ hg log -G
1607 o 6:e4f78693cc88 D
1608 |
1609 o 5:76840d832e98 B
1610 |
1611 o 4:50e41c1f3950 Z
1612 |
1613 o 2:96cc3511f894 C
1614
1615 $ hg files -r tip
1616 B
1617 C
1618 D
1619 Z
1620
1621 $ cd ..
1622
1623 $ hg init p1-move-p2-succ
1624 $ cd p1-move-p2-succ
1625 $ hg debugdrawdag <<'EOS'
1626 > D Z
1627 > /| | # replace: B -> C
1628 > A B C # D/D = D
1629 > EOS
1630 1 new orphan changesets
1631 $ hg rebase -r B+A+D -d Z
1632 rebasing 0:426bada5c675 A "A"
1633 note: not rebasing 1:fc2b737bb2e5 B "B", already in destination as 2:96cc3511f894 C "C"
1634 rebasing 3:b8ed089c80ad D "D"
1635
1636 $ rm .hg/localtags
1637 $ hg log -G
1638 o 6:1b355ed94d82 D
1639 |
1640 o 5:a81a74d764a6 A
1641 |
1642 o 4:50e41c1f3950 Z
1643 |
1644 o 2:96cc3511f894 C
1645
1646 $ hg files -r tip
1647 A
1648 C
1649 D
1650 Z
1651
1652 $ cd ..
1653
1654 Test that bookmark is moved and working dir is updated when all changesets have
1655 equivalents in destination
1656 $ hg init rbsrepo && cd rbsrepo
1657 $ echo "[experimental]" > .hg/hgrc
1658 $ echo "evolution=true" >> .hg/hgrc
1659 $ echo "rebaseskipobsolete=on" >> .hg/hgrc
1660 $ echo root > root && hg ci -Am root
1661 adding root
1662 $ echo a > a && hg ci -Am a
1663 adding a
1664 $ hg up 0
1665 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1666 $ echo b > b && hg ci -Am b
1667 adding b
1668 created new head
1669 $ hg rebase -r 2 -d 1
1670 rebasing 2:1e9a3c00cbe9 tip "b"
1671 $ hg log -r . # working dir is at rev 3 (successor of 2)
1672 3:be1832deae9a b (no-eol)
1673 $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now
1674 bookmarking hidden changeset 1e9a3c00cbe9
1675 (hidden revision '1e9a3c00cbe9' was rewritten as: be1832deae9a)
1676 $ hg up 2 && hg log -r . # working dir is at rev 2 again
1677 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1678 2:1e9a3c00cbe9 b (rewritten using rebase as 3:be1832deae9a) (no-eol)
1679 $ hg rebase -r 2 -d 3 --config experimental.evolution.track-operation=1
1680 note: not rebasing 2:1e9a3c00cbe9 mybook "b", already in destination as 3:be1832deae9a tip "b"
1681 Check that working directory and bookmark was updated to rev 3 although rev 2
1682 was skipped
1683 $ hg log -r .
1684 3:be1832deae9a b (no-eol)
1685 $ hg bookmarks
1686 mybook 3:be1832deae9a
1687 $ hg debugobsolete --rev tip
1688 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
1689
1690 Obsoleted working parent and bookmark could be moved if an ancestor of working
1691 parent gets moved:
1692
1693 $ hg init $TESTTMP/ancestor-wd-move
1694 $ cd $TESTTMP/ancestor-wd-move
1695 $ hg debugdrawdag <<'EOS'
1696 > E D1 # rebase: D1 -> D2
1697 > | |
1698 > | C
1699 > D2 |
1700 > | B
1701 > |/
1702 > A
1703 > EOS
1704 $ hg update D1 -q
1705 $ hg bookmark book -i
1706 $ hg rebase -r B+D1 -d E
1707 rebasing 1:112478962961 B "B"
1708 note: not rebasing 5:15ecf15e0114 book D1 tip "D1", already in destination as 2:0807738e0be9 D2 "D2"
1709 1 new orphan changesets
1710 $ hg log -G -T '{desc} {bookmarks}'
1711 @ B book
1712 |
1713 | x D1
1714 | |
1715 o | E
1716 | |
1717 | * C
1718 | |
1719 o | D2
1720 | |
1721 | x B
1722 |/
1723 o A
1724
1725 Rebasing a merge with one of its parent having a hidden successor
1726
1727 $ hg init $TESTTMP/merge-p1-hidden-successor
1728 $ cd $TESTTMP/merge-p1-hidden-successor
1729
1730 $ hg debugdrawdag <<'EOS'
1731 > E
1732 > |
1733 > B3 B2 # amend: B1 -> B2 -> B3
1734 > |/ # B2 is hidden
1735 > | D
1736 > | |\
1737 > | B1 C
1738 > |/
1739 > A
1740 > EOS
1741 1 new orphan changesets
1742
1743 $ eval `hg tags -T '{tag}={node}\n'`
1744 $ rm .hg/localtags
1745
1746 $ hg rebase -r $D -d $E
1747 rebasing 5:9e62094e4d94 "D"
1748
1749 $ hg log -G
1750 o 7:a699d059adcf D
1751 |\
1752 | o 6:ecc93090a95c E
1753 | |
1754 | o 4:0dc878468a23 B3
1755 | |
1756 o | 1:96cc3511f894 C
1757 /
1758 o 0:426bada5c675 A
1759
1760 For some reasons (--hidden, rebaseskipobsolete=0, directaccess, etc.),
1761 rebasestate may contain hidden hashes. "rebase --abort" should work regardless.
1762
1763 $ hg init $TESTTMP/hidden-state1
1764 $ cd $TESTTMP/hidden-state1
1765 $ cat >> .hg/hgrc <<EOF
1766 > [experimental]
1767 > rebaseskipobsolete=0
1768 > EOF
1769
1770 $ hg debugdrawdag <<'EOS'
1771 > C
1772 > |
1773 > D B # prune: B, C
1774 > |/ # B/D=B
1775 > A
1776 > EOS
1777
1778 $ eval `hg tags -T '{tag}={node}\n'`
1779 $ rm .hg/localtags
1780
1781 $ hg update -q $C --hidden
1782 updated to hidden changeset 7829726be4dc
1783 (hidden revision '7829726be4dc' is pruned)
1784 $ hg rebase -s $B -d $D
1785 rebasing 1:2ec65233581b "B"
1786 merging D
1787 warning: conflicts while merging D! (edit, then use 'hg resolve --mark')
1788 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1789 [240]
1790
1791 $ cp -R . $TESTTMP/hidden-state2
1792
1793 $ hg log -G
1794 @ 2:b18e25de2cf5 D
1795 |
1796 | % 1:2ec65233581b B (pruned using prune)
1797 |/
1798 o 0:426bada5c675 A
1799
1800 $ hg summary
1801 parent: 2:b18e25de2cf5 tip
1802 D
1803 branch: default
1804 commit: 1 modified, 1 added, 1 unknown, 1 unresolved
1805 update: 1 new changesets, 2 branch heads (merge)
1806 phases: 3 draft
1807 rebase: 0 rebased, 2 remaining (rebase --continue)
1808
1809 $ hg rebase --abort
1810 rebase aborted
1811
1812 Also test --continue for the above case
1813
1814 $ cd $TESTTMP/hidden-state2
1815 $ hg resolve -m
1816 (no more unresolved files)
1817 continue: hg rebase --continue
1818 $ hg rebase --continue
1819 rebasing 1:2ec65233581b "B"
1820 rebasing 3:7829726be4dc tip "C"
1821 $ hg log -G
1822 @ 5:1964d5d5b547 C
1823 |
1824 o 4:68deb90c12a2 B
1825 |
1826 o 2:b18e25de2cf5 D
1827 |
1828 o 0:426bada5c675 A
1829
1830 ====================
1831 Test --stop option |
1832 ====================
1833 $ cd ..
1834 $ hg init rbstop
1835 $ cd rbstop
1836 $ echo a>a
1837 $ hg ci -Aqma
1838 $ echo b>b
1839 $ hg ci -Aqmb
1840 $ echo c>c
1841 $ hg ci -Aqmc
1842 $ echo d>d
1843 $ hg ci -Aqmd
1844 $ hg up 0 -q
1845 $ echo f>f
1846 $ hg ci -Aqmf
1847 $ echo D>d
1848 $ hg ci -Aqm "conflict with d"
1849 $ hg up 3 -q
1850 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1851 o 5:00bfc9898aeb test
1852 | conflict with d
1853 |
1854 o 4:dafd40200f93 test
1855 | f
1856 |
1857 | @ 3:055a42cdd887 test
1858 | | d
1859 | |
1860 | o 2:177f92b77385 test
1861 | | c
1862 | |
1863 | o 1:d2ae7f538514 test
1864 |/ b
1865 |
1866 o 0:cb9a9f314b8b test
1867 a
1868
1869 $ hg rebase -s 1 -d 5
1870 rebasing 1:d2ae7f538514 "b"
1871 rebasing 2:177f92b77385 "c"
1872 rebasing 3:055a42cdd887 "d"
1873 merging d
1874 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1875 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1876 [240]
1877 $ hg rebase --stop
1878 1 new orphan changesets
1879 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1880 o 7:7fffad344617 test
1881 | c
1882 |
1883 o 6:b15528633407 test
1884 | b
1885 |
1886 o 5:00bfc9898aeb test
1887 | conflict with d
1888 |
1889 o 4:dafd40200f93 test
1890 | f
1891 |
1892 | @ 3:055a42cdd887 test
1893 | | d
1894 | |
1895 | x 2:177f92b77385 test
1896 | | c
1897 | |
1898 | x 1:d2ae7f538514 test
1899 |/ b
1900 |
1901 o 0:cb9a9f314b8b test
1902 a
1903
1904 Test it aborts if unstable csets is not allowed:
1905 ===============================================
1906 $ cat >> $HGRCPATH << EOF
1907 > [experimental]
1908 > evolution.allowunstable=False
1909 > EOF
1910
1911 $ hg strip 6 --no-backup -q
1912 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1913 o 5:00bfc9898aeb test
1914 | conflict with d
1915 |
1916 o 4:dafd40200f93 test
1917 | f
1918 |
1919 | @ 3:055a42cdd887 test
1920 | | d
1921 | |
1922 | o 2:177f92b77385 test
1923 | | c
1924 | |
1925 | o 1:d2ae7f538514 test
1926 |/ b
1927 |
1928 o 0:cb9a9f314b8b test
1929 a
1930
1931 $ hg rebase -s 1 -d 5
1932 rebasing 1:d2ae7f538514 "b"
1933 rebasing 2:177f92b77385 "c"
1934 rebasing 3:055a42cdd887 "d"
1935 merging d
1936 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1937 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1938 [240]
1939 $ hg rebase --stop
1940 abort: cannot remove original changesets with unrebased descendants
1941 (either enable obsmarkers to allow unstable revisions or use --keep to keep original changesets)
1942 [20]
1943 $ hg rebase --abort
1944 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1945 rebase aborted
1946
1947 Test --stop when --keep is passed:
1948 ==================================
1949 $ hg rebase -s 1 -d 5 --keep
1950 rebasing 1:d2ae7f538514 "b"
1951 rebasing 2:177f92b77385 "c"
1952 rebasing 3:055a42cdd887 "d"
1953 merging d
1954 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1955 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1956 [240]
1957 $ hg rebase --stop
1958 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1959 o 7:7fffad344617 test
1960 | c
1961 |
1962 o 6:b15528633407 test
1963 | b
1964 |
1965 o 5:00bfc9898aeb test
1966 | conflict with d
1967 |
1968 o 4:dafd40200f93 test
1969 | f
1970 |
1971 | @ 3:055a42cdd887 test
1972 | | d
1973 | |
1974 | o 2:177f92b77385 test
1975 | | c
1976 | |
1977 | o 1:d2ae7f538514 test
1978 |/ b
1979 |
1980 o 0:cb9a9f314b8b test
1981 a
1982
1983 Test --stop aborts when --collapse was passed:
1984 =============================================
1985 $ cat >> $HGRCPATH << EOF
1986 > [experimental]
1987 > evolution.allowunstable=True
1988 > EOF
1989
1990 $ hg strip 6
1991 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1992 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1993 o 5:00bfc9898aeb test
1994 | conflict with d
1995 |
1996 o 4:dafd40200f93 test
1997 | f
1998 |
1999 | @ 3:055a42cdd887 test
2000 | | d
2001 | |
2002 | o 2:177f92b77385 test
2003 | | c
2004 | |
2005 | o 1:d2ae7f538514 test
2006 |/ b
2007 |
2008 o 0:cb9a9f314b8b test
2009 a
2010
2011 $ hg rebase -s 1 -d 5 --collapse -m "collapsed b c d"
2012 rebasing 1:d2ae7f538514 "b"
2013 rebasing 2:177f92b77385 "c"
2014 rebasing 3:055a42cdd887 "d"
2015 merging d
2016 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2017 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2018 [240]
2019 $ hg rebase --stop
2020 abort: cannot stop in --collapse session
2021 [20]
2022 $ hg rebase --abort
2023 rebase aborted
2024 $ hg diff
2025 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
2026 o 5:00bfc9898aeb test
2027 | conflict with d
2028 |
2029 o 4:dafd40200f93 test
2030 | f
2031 |
2032 | @ 3:055a42cdd887 test
2033 | | d
2034 | |
2035 | o 2:177f92b77385 test
2036 | | c
2037 | |
2038 | o 1:d2ae7f538514 test
2039 |/ b
2040 |
2041 o 0:cb9a9f314b8b test
2042 a
2043
2044 Test --stop raise errors with conflicting options:
2045 =================================================
2046 $ hg rebase -s 3 -d 5
2047 rebasing 3:055a42cdd887 "d"
2048 merging d
2049 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2050 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2051 [240]
2052 $ hg rebase --stop --dry-run
2053 abort: cannot specify both --stop and --dry-run
2054 [10]
2055
2056 $ hg rebase -s 3 -d 5
2057 abort: rebase in progress
2058 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
2059 [20]
2060 $ hg rebase --stop --continue
2061 abort: cannot specify both --stop and --continue
2062 [10]
2063
2064 Test --stop moves bookmarks of original revisions to new rebased nodes:
2065 ======================================================================
2066 $ cd ..
2067 $ hg init repo
2068 $ cd repo
2069
2070 $ echo a > a
2071 $ hg ci -Am A
2072 adding a
2073
2074 $ echo b > b
2075 $ hg ci -Am B
2076 adding b
2077 $ hg book X
2078 $ hg book Y
2079
2080 $ echo c > c
2081 $ hg ci -Am C
2082 adding c
2083 $ hg book Z
2084
2085 $ echo d > d
2086 $ hg ci -Am D
2087 adding d
2088
2089 $ hg up 0 -q
2090 $ echo e > e
2091 $ hg ci -Am E
2092 adding e
2093 created new head
2094
2095 $ echo doubt > d
2096 $ hg ci -Am "conflict with d"
2097 adding d
2098
2099 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2100 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2101 |
2102 o 4: 9c1e55f411b6 'E' bookmarks:
2103 |
2104 | o 3: 67a385d4e6f2 'D' bookmarks: Z
2105 | |
2106 | o 2: 49cb3485fa0c 'C' bookmarks: Y
2107 | |
2108 | o 1: 6c81ed0049f8 'B' bookmarks: X
2109 |/
2110 o 0: 1994f17a630e 'A' bookmarks:
2111
2112 $ hg rebase -s 1 -d 5
2113 rebasing 1:6c81ed0049f8 X "B"
2114 rebasing 2:49cb3485fa0c Y "C"
2115 rebasing 3:67a385d4e6f2 Z "D"
2116 merging d
2117 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2118 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2119 [240]
2120 $ hg rebase --stop
2121 1 new orphan changesets
2122 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2123 o 7: 9c86c650b686 'C' bookmarks: Y
2124 |
2125 o 6: 9b87b54e5fd8 'B' bookmarks: X
2126 |
2127 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2128 |
2129 o 4: 9c1e55f411b6 'E' bookmarks:
2130 |
2131 | * 3: 67a385d4e6f2 'D' bookmarks: Z
2132 | |
2133 | x 2: 49cb3485fa0c 'C' bookmarks:
2134 | |
2135 | x 1: 6c81ed0049f8 'B' bookmarks:
2136 |/
2137 o 0: 1994f17a630e 'A' bookmarks:
2138
This diff has been collapsed as it changes many lines, (1512 lines changed) Show them Hide them
@@ -18,1032 +18,6 b' Enable obsolete'
18 > strip=
18 > strip=
19 > EOF
19 > EOF
20
20
21 Setup rebase canonical repo
22
23 $ hg init base
24 $ cd base
25 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
26 adding changesets
27 adding manifests
28 adding file changes
29 added 8 changesets with 7 changes to 7 files (+2 heads)
30 new changesets cd010b8cd998:02de42196ebe (8 drafts)
31 (run 'hg heads' to see heads, 'hg merge' to merge)
32 $ hg up tip
33 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ hg log -G
35 @ 7:02de42196ebe H
36 |
37 | o 6:eea13746799a G
38 |/|
39 o | 5:24b6387c8c8c F
40 | |
41 | o 4:9520eea781bc E
42 |/
43 | o 3:32af7686d403 D
44 | |
45 | o 2:5fddd98957c8 C
46 | |
47 | o 1:42ccdea3bb16 B
48 |/
49 o 0:cd010b8cd998 A
50
51 $ cd ..
52
53 simple rebase
54 ---------------------------------
55
56 $ hg clone base simple
57 updating to branch default
58 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 $ cd simple
60 $ hg up 32af7686d403
61 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
62 $ hg rebase -d eea13746799a
63 rebasing 1:42ccdea3bb16 "B"
64 rebasing 2:5fddd98957c8 "C"
65 rebasing 3:32af7686d403 "D"
66 $ hg log -G
67 @ 10:8eeb3c33ad33 D
68 |
69 o 9:2327fea05063 C
70 |
71 o 8:e4e5be0395b2 B
72 |
73 | o 7:02de42196ebe H
74 | |
75 o | 6:eea13746799a G
76 |\|
77 | o 5:24b6387c8c8c F
78 | |
79 o | 4:9520eea781bc E
80 |/
81 o 0:cd010b8cd998 A
82
83 $ hg log --hidden -G
84 @ 10:8eeb3c33ad33 D
85 |
86 o 9:2327fea05063 C
87 |
88 o 8:e4e5be0395b2 B
89 |
90 | o 7:02de42196ebe H
91 | |
92 o | 6:eea13746799a G
93 |\|
94 | o 5:24b6387c8c8c F
95 | |
96 o | 4:9520eea781bc E
97 |/
98 | x 3:32af7686d403 D (rewritten using rebase as 10:8eeb3c33ad33)
99 | |
100 | x 2:5fddd98957c8 C (rewritten using rebase as 9:2327fea05063)
101 | |
102 | x 1:42ccdea3bb16 B (rewritten using rebase as 8:e4e5be0395b2)
103 |/
104 o 0:cd010b8cd998 A
105
106 $ hg debugobsolete
107 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
108 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
109 32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
110
111
112 $ cd ..
113
114 empty changeset
115 ---------------------------------
116
117 $ hg clone base empty
118 updating to branch default
119 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 $ cd empty
121 $ hg up eea13746799a
122 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
123
124 We make a copy of both the first changeset in the rebased and some other in the
125 set.
126
127 $ hg graft 42ccdea3bb16 32af7686d403
128 grafting 1:42ccdea3bb16 "B"
129 grafting 3:32af7686d403 "D"
130 $ hg rebase -s 42ccdea3bb16 -d .
131 rebasing 1:42ccdea3bb16 "B"
132 note: not rebasing 1:42ccdea3bb16 "B", its destination already has all its changes
133 rebasing 2:5fddd98957c8 "C"
134 rebasing 3:32af7686d403 "D"
135 note: not rebasing 3:32af7686d403 "D", its destination already has all its changes
136 $ hg log -G
137 o 10:5ae4c968c6ac C
138 |
139 @ 9:08483444fef9 D
140 |
141 o 8:8877864f1edb B
142 |
143 | o 7:02de42196ebe H
144 | |
145 o | 6:eea13746799a G
146 |\|
147 | o 5:24b6387c8c8c F
148 | |
149 o | 4:9520eea781bc E
150 |/
151 o 0:cd010b8cd998 A
152
153 $ hg log --hidden -G
154 o 10:5ae4c968c6ac C
155 |
156 @ 9:08483444fef9 D
157 |
158 o 8:8877864f1edb B
159 |
160 | o 7:02de42196ebe H
161 | |
162 o | 6:eea13746799a G
163 |\|
164 | o 5:24b6387c8c8c F
165 | |
166 o | 4:9520eea781bc E
167 |/
168 | x 3:32af7686d403 D (pruned using rebase)
169 | |
170 | x 2:5fddd98957c8 C (rewritten using rebase as 10:5ae4c968c6ac)
171 | |
172 | x 1:42ccdea3bb16 B (pruned using rebase)
173 |/
174 o 0:cd010b8cd998 A
175
176 $ hg debugobsolete
177 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
178 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
179 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
180
181
182 More complex case where part of the rebase set were already rebased
183
184 $ hg rebase --rev 'desc(D)' --dest 'desc(H)'
185 rebasing 9:08483444fef9 "D"
186 1 new orphan changesets
187 $ hg debugobsolete
188 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
189 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
190 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
191 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
192 $ hg log -G
193 @ 11:4596109a6a43 D
194 |
195 | * 10:5ae4c968c6ac C
196 | |
197 | x 9:08483444fef9 D (rewritten using rebase as 11:4596109a6a43)
198 | |
199 | o 8:8877864f1edb B
200 | |
201 o | 7:02de42196ebe H
202 | |
203 | o 6:eea13746799a G
204 |/|
205 o | 5:24b6387c8c8c F
206 | |
207 | o 4:9520eea781bc E
208 |/
209 o 0:cd010b8cd998 A
210
211 $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True
212 rebasing 8:8877864f1edb "B"
213 note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 tip "D"
214 rebasing 10:5ae4c968c6ac "C"
215 $ hg debugobsolete
216 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
217 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
218 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
219 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
220 8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
221 5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
222 $ hg log --rev 'contentdivergent()'
223 $ hg log -G
224 o 13:98f6af4ee953 C
225 |
226 o 12:462a34d07e59 B
227 |
228 @ 11:4596109a6a43 D
229 |
230 o 7:02de42196ebe H
231 |
232 | o 6:eea13746799a G
233 |/|
234 o | 5:24b6387c8c8c F
235 | |
236 | o 4:9520eea781bc E
237 |/
238 o 0:cd010b8cd998 A
239
240 $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003
241 changeset: 11:4596109a6a4328c398bde3a4a3b6737cfade3003
242 phase: draft
243 parent: 7:02de42196ebee42ef284b6780a87cdc96e8eaab6
244 parent: -1:0000000000000000000000000000000000000000
245 manifest: 11:a91006e3a02f1edf631f7018e6e5684cf27dd905
246 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
247 date: Sat Apr 30 15:24:48 2011 +0200
248 files+: D
249 extra: branch=default
250 extra: rebase_source=08483444fef91d6224f6655ee586a65d263ad34c
251 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
252 description:
253 D
254
255
256 $ hg up -qr 'desc(G)'
257 $ hg graft 4596109a6a4328c398bde3a4a3b6737cfade3003
258 grafting 11:4596109a6a43 "D"
259 $ hg up -qr 'desc(E)'
260 $ hg rebase -s tip -d .
261 rebasing 14:9e36056a46e3 tip "D"
262 $ hg log --style default --debug -r tip
263 changeset: 15:627d4614809036ba22b9e7cb31638ddc06ab99ab
264 tag: tip
265 phase: draft
266 parent: 4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba
267 parent: -1:0000000000000000000000000000000000000000
268 manifest: 15:648e8ede73ae3e497d093d3a4c8fcc2daa864f42
269 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
270 date: Sat Apr 30 15:24:48 2011 +0200
271 files+: D
272 extra: branch=default
273 extra: intermediate-source=4596109a6a4328c398bde3a4a3b6737cfade3003
274 extra: rebase_source=9e36056a46e37c9776168c7375734eebc70e294f
275 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
276 description:
277 D
278
279
280 Start rebase from a commit that is obsolete but not hidden only because it's
281 a working copy parent. We should be moved back to the starting commit as usual
282 even though it is hidden (until we're moved there).
283
284 $ hg --hidden up -qr 'first(hidden())'
285 updated to hidden changeset 42ccdea3bb16
286 (hidden revision '42ccdea3bb16' is pruned)
287 $ hg rebase --rev 13 --dest 15
288 rebasing 13:98f6af4ee953 "C"
289 $ hg log -G
290 o 16:294a2b93eb4d C
291 |
292 o 15:627d46148090 D
293 |
294 | o 12:462a34d07e59 B
295 | |
296 | o 11:4596109a6a43 D
297 | |
298 | o 7:02de42196ebe H
299 | |
300 +---o 6:eea13746799a G
301 | |/
302 | o 5:24b6387c8c8c F
303 | |
304 o | 4:9520eea781bc E
305 |/
306 | @ 1:42ccdea3bb16 B (pruned using rebase)
307 |/
308 o 0:cd010b8cd998 A
309
310
311 $ cd ..
312
313 collapse rebase
314 ---------------------------------
315
316 $ hg clone base collapse
317 updating to branch default
318 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
319 $ cd collapse
320 $ hg rebase -s 42ccdea3bb16 -d eea13746799a --collapse
321 rebasing 1:42ccdea3bb16 "B"
322 rebasing 2:5fddd98957c8 "C"
323 rebasing 3:32af7686d403 "D"
324 $ hg log -G
325 o 8:4dc2197e807b Collapsed revision
326 |
327 | @ 7:02de42196ebe H
328 | |
329 o | 6:eea13746799a G
330 |\|
331 | o 5:24b6387c8c8c F
332 | |
333 o | 4:9520eea781bc E
334 |/
335 o 0:cd010b8cd998 A
336
337 $ hg log --hidden -G
338 o 8:4dc2197e807b Collapsed revision
339 |
340 | @ 7:02de42196ebe H
341 | |
342 o | 6:eea13746799a G
343 |\|
344 | o 5:24b6387c8c8c F
345 | |
346 o | 4:9520eea781bc E
347 |/
348 | x 3:32af7686d403 D (rewritten using rebase as 8:4dc2197e807b)
349 | |
350 | x 2:5fddd98957c8 C (rewritten using rebase as 8:4dc2197e807b)
351 | |
352 | x 1:42ccdea3bb16 B (rewritten using rebase as 8:4dc2197e807b)
353 |/
354 o 0:cd010b8cd998 A
355
356 $ hg id --debug -r tip
357 4dc2197e807bae9817f09905b50ab288be2dbbcf tip
358 $ hg debugobsolete
359 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '1', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
360 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '2', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
361 32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '3', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
362
363 $ cd ..
364
365 Rebase set has hidden descendants
366 ---------------------------------
367
368 We rebase a changeset which has hidden descendants. Hidden changesets must not
369 be rebased.
370
371 $ hg clone base hidden
372 updating to branch default
373 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
374 $ cd hidden
375 $ hg log -G
376 @ 7:02de42196ebe H
377 |
378 | o 6:eea13746799a G
379 |/|
380 o | 5:24b6387c8c8c F
381 | |
382 | o 4:9520eea781bc E
383 |/
384 | o 3:32af7686d403 D
385 | |
386 | o 2:5fddd98957c8 C
387 | |
388 | o 1:42ccdea3bb16 B
389 |/
390 o 0:cd010b8cd998 A
391
392 $ hg rebase -s 5fddd98957c8 -d eea13746799a
393 rebasing 2:5fddd98957c8 "C"
394 rebasing 3:32af7686d403 "D"
395 $ hg log -G
396 o 9:cf44d2f5a9f4 D
397 |
398 o 8:e273c5e7d2d2 C
399 |
400 | @ 7:02de42196ebe H
401 | |
402 o | 6:eea13746799a G
403 |\|
404 | o 5:24b6387c8c8c F
405 | |
406 o | 4:9520eea781bc E
407 |/
408 | o 1:42ccdea3bb16 B
409 |/
410 o 0:cd010b8cd998 A
411
412 $ hg rebase -s 42ccdea3bb16 -d 02de42196ebe
413 rebasing 1:42ccdea3bb16 "B"
414 $ hg log -G
415 o 10:7c6027df6a99 B
416 |
417 | o 9:cf44d2f5a9f4 D
418 | |
419 | o 8:e273c5e7d2d2 C
420 | |
421 @ | 7:02de42196ebe H
422 | |
423 | o 6:eea13746799a G
424 |/|
425 o | 5:24b6387c8c8c F
426 | |
427 | o 4:9520eea781bc E
428 |/
429 o 0:cd010b8cd998 A
430
431 $ hg log --hidden -G
432 o 10:7c6027df6a99 B
433 |
434 | o 9:cf44d2f5a9f4 D
435 | |
436 | o 8:e273c5e7d2d2 C
437 | |
438 @ | 7:02de42196ebe H
439 | |
440 | o 6:eea13746799a G
441 |/|
442 o | 5:24b6387c8c8c F
443 | |
444 | o 4:9520eea781bc E
445 |/
446 | x 3:32af7686d403 D (rewritten using rebase as 9:cf44d2f5a9f4)
447 | |
448 | x 2:5fddd98957c8 C (rewritten using rebase as 8:e273c5e7d2d2)
449 | |
450 | x 1:42ccdea3bb16 B (rewritten using rebase as 10:7c6027df6a99)
451 |/
452 o 0:cd010b8cd998 A
453
454 $ hg debugobsolete
455 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
456 32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
457 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
458
459 Test that rewriting leaving instability behind is allowed
460 ---------------------------------------------------------------------
461
462 $ hg log -r 'children(8)'
463 9:cf44d2f5a9f4 D (no-eol)
464 $ hg rebase -r 8
465 rebasing 8:e273c5e7d2d2 "C"
466 1 new orphan changesets
467 $ hg log -G
468 o 11:0d8f238b634c C
469 |
470 o 10:7c6027df6a99 B
471 |
472 | * 9:cf44d2f5a9f4 D
473 | |
474 | x 8:e273c5e7d2d2 C (rewritten using rebase as 11:0d8f238b634c)
475 | |
476 @ | 7:02de42196ebe H
477 | |
478 | o 6:eea13746799a G
479 |/|
480 o | 5:24b6387c8c8c F
481 | |
482 | o 4:9520eea781bc E
483 |/
484 o 0:cd010b8cd998 A
485
486 $ cd ..
487 $ cp -R hidden stabilize
488 $ cd stabilize
489 $ hg rebase --auto-orphans '0::' -d 10
490 abort: cannot specify both --auto-orphans and --dest
491 [10]
492 $ hg rebase --auto-orphans '0::'
493 rebasing 9:cf44d2f5a9f4 "D"
494 $ hg log -G
495 o 12:7e3935feaa68 D
496 |
497 o 11:0d8f238b634c C
498 |
499 o 10:7c6027df6a99 B
500 |
501 @ 7:02de42196ebe H
502 |
503 | o 6:eea13746799a G
504 |/|
505 o | 5:24b6387c8c8c F
506 | |
507 | o 4:9520eea781bc E
508 |/
509 o 0:cd010b8cd998 A
510
511
512 $ cd ../hidden
513 $ rm -r ../stabilize
514
515 Test multiple root handling
516 ------------------------------------
517
518 $ hg rebase --dest 4 --rev '7+11+9'
519 rebasing 9:cf44d2f5a9f4 "D"
520 rebasing 7:02de42196ebe "H"
521 rebasing 11:0d8f238b634c tip "C"
522 $ hg log -G
523 o 14:1e8370e38cca C
524 |
525 @ 13:bfe264faf697 H
526 |
527 | o 12:102b4c1d889b D
528 |/
529 | * 10:7c6027df6a99 B
530 | |
531 | x 7:02de42196ebe H (rewritten using rebase as 13:bfe264faf697)
532 | |
533 +---o 6:eea13746799a G
534 | |/
535 | o 5:24b6387c8c8c F
536 | |
537 o | 4:9520eea781bc E
538 |/
539 o 0:cd010b8cd998 A
540
541 $ cd ..
542
543 Detach both parents
544
545 $ hg init double-detach
546 $ cd double-detach
547
548 $ hg debugdrawdag <<EOF
549 > F
550 > /|
551 > C E
552 > | |
553 > B D G
554 > \|/
555 > A
556 > EOF
557
558 $ hg rebase -d G -r 'B + D + F'
559 rebasing 1:112478962961 B "B"
560 rebasing 2:b18e25de2cf5 D "D"
561 rebasing 6:f15c3adaf214 F tip "F"
562 abort: cannot rebase 6:f15c3adaf214 without moving at least one of its parents
563 [10]
564
565 $ cd ..
566
567 test on rebase dropping a merge
568
569 (setup)
570
571 $ hg init dropmerge
572 $ cd dropmerge
573 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
574 adding changesets
575 adding manifests
576 adding file changes
577 added 8 changesets with 7 changes to 7 files (+2 heads)
578 new changesets cd010b8cd998:02de42196ebe (8 drafts)
579 (run 'hg heads' to see heads, 'hg merge' to merge)
580 $ hg up 3
581 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
582 $ hg merge 7
583 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
584 (branch merge, don't forget to commit)
585 $ hg ci -m 'M'
586 $ echo I > I
587 $ hg add I
588 $ hg ci -m I
589 $ hg log -G
590 @ 9:4bde274eefcf I
591 |
592 o 8:53a6a128b2b7 M
593 |\
594 | o 7:02de42196ebe H
595 | |
596 | | o 6:eea13746799a G
597 | |/|
598 | o | 5:24b6387c8c8c F
599 | | |
600 | | o 4:9520eea781bc E
601 | |/
602 o | 3:32af7686d403 D
603 | |
604 o | 2:5fddd98957c8 C
605 | |
606 o | 1:42ccdea3bb16 B
607 |/
608 o 0:cd010b8cd998 A
609
610 (actual test)
611
612 $ hg rebase --dest 6 --rev '((desc(H) + desc(D))::) - desc(M)'
613 rebasing 3:32af7686d403 "D"
614 rebasing 7:02de42196ebe "H"
615 rebasing 9:4bde274eefcf tip "I"
616 1 new orphan changesets
617 $ hg log -G
618 @ 12:acd174b7ab39 I
619 |
620 o 11:6c11a6218c97 H
621 |
622 | o 10:b5313c85b22e D
623 |/
624 | * 8:53a6a128b2b7 M
625 | |\
626 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
627 | | |
628 o---+ 6:eea13746799a G
629 | | |
630 | | o 5:24b6387c8c8c F
631 | | |
632 o---+ 4:9520eea781bc E
633 / /
634 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
635 | |
636 o | 2:5fddd98957c8 C
637 | |
638 o | 1:42ccdea3bb16 B
639 |/
640 o 0:cd010b8cd998 A
641
642
643 Test hidden changesets in the rebase set (issue4504)
644
645 $ hg up --hidden 9
646 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
647 updated to hidden changeset 4bde274eefcf
648 (hidden revision '4bde274eefcf' was rewritten as: acd174b7ab39)
649 $ echo J > J
650 $ hg add J
651 $ hg commit -m J
652 1 new orphan changesets
653 $ hg debugobsolete `hg log --rev . -T '{node}'`
654 1 new obsolescence markers
655 obsoleted 1 changesets
656
657 $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback --config experimental.rebaseskipobsolete=off
658 rebasing 9:4bde274eefcf "I"
659 rebasing 13:06edfc82198f tip "J"
660 2 new content-divergent changesets
661 $ hg log -G
662 @ 15:5ae8a643467b J
663 |
664 * 14:9ad579b4a5de I
665 |
666 | * 12:acd174b7ab39 I
667 | |
668 | o 11:6c11a6218c97 H
669 | |
670 o | 10:b5313c85b22e D
671 |/
672 | * 8:53a6a128b2b7 M
673 | |\
674 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
675 | | |
676 o---+ 6:eea13746799a G
677 | | |
678 | | o 5:24b6387c8c8c F
679 | | |
680 o---+ 4:9520eea781bc E
681 / /
682 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
683 | |
684 o | 2:5fddd98957c8 C
685 | |
686 o | 1:42ccdea3bb16 B
687 |/
688 o 0:cd010b8cd998 A
689
690 $ hg up 14 -C
691 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
692 $ echo "K" > K
693 $ hg add K
694 $ hg commit --amend -m "K"
695 1 new orphan changesets
696 $ echo "L" > L
697 $ hg add L
698 $ hg commit -m "L"
699 $ hg up '.^'
700 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
701 $ echo "M" > M
702 $ hg add M
703 $ hg commit --amend -m "M"
704 1 new orphan changesets
705 $ hg log -G
706 @ 18:bfaedf8eb73b M
707 |
708 | * 17:97219452e4bd L
709 | |
710 | x 16:fc37a630c901 K (rewritten using amend as 18:bfaedf8eb73b)
711 |/
712 | * 15:5ae8a643467b J
713 | |
714 | x 14:9ad579b4a5de I (rewritten using amend as 16:fc37a630c901)
715 |/
716 | * 12:acd174b7ab39 I
717 | |
718 | o 11:6c11a6218c97 H
719 | |
720 o | 10:b5313c85b22e D
721 |/
722 | * 8:53a6a128b2b7 M
723 | |\
724 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
725 | | |
726 o---+ 6:eea13746799a G
727 | | |
728 | | o 5:24b6387c8c8c F
729 | | |
730 o---+ 4:9520eea781bc E
731 / /
732 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
733 | |
734 o | 2:5fddd98957c8 C
735 | |
736 o | 1:42ccdea3bb16 B
737 |/
738 o 0:cd010b8cd998 A
739
740 $ hg rebase -s 14 -d 17 --config experimental.rebaseskipobsolete=True
741 note: not rebasing 14:9ad579b4a5de "I", already in destination as 16:fc37a630c901 "K"
742 rebasing 15:5ae8a643467b "J"
743 1 new orphan changesets
744
745 $ cd ..
746
747 Skip obsolete changeset even with multiple hops
748 -----------------------------------------------
749
750 setup
751
752 $ hg init obsskip
753 $ cd obsskip
754 $ cat << EOF >> .hg/hgrc
755 > [experimental]
756 > rebaseskipobsolete = True
757 > [extensions]
758 > strip =
759 > EOF
760 $ echo A > A
761 $ hg add A
762 $ hg commit -m A
763 $ echo B > B
764 $ hg add B
765 $ hg commit -m B0
766 $ hg commit --amend -m B1
767 $ hg commit --amend -m B2
768 $ hg up --hidden 'desc(B0)'
769 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
770 updated to hidden changeset a8b11f55fb19
771 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
772 $ echo C > C
773 $ hg add C
774 $ hg commit -m C
775 1 new orphan changesets
776 $ hg log -G
777 @ 4:212cb178bcbb C
778 |
779 | o 3:261e70097290 B2
780 | |
781 x | 1:a8b11f55fb19 B0 (rewritten using amend as 3:261e70097290)
782 |/
783 o 0:4a2df7238c3b A
784
785
786 Rebase finds its way in a chain of marker
787
788 $ hg rebase -d 'desc(B2)'
789 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
790 rebasing 4:212cb178bcbb tip "C"
791
792 Even when the chain include missing node
793
794 $ hg up --hidden 'desc(B0)'
795 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
796 updated to hidden changeset a8b11f55fb19
797 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
798 $ echo D > D
799 $ hg add D
800 $ hg commit -m D
801 1 new orphan changesets
802 $ hg --hidden strip -r 'desc(B1)'
803 saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg
804 1 new orphan changesets
805 $ hg log -G
806 @ 5:1a79b7535141 D
807 |
808 | o 4:ff2c4d47b71d C
809 | |
810 | o 2:261e70097290 B2
811 | |
812 x | 1:a8b11f55fb19 B0 (rewritten using amend as 2:261e70097290)
813 |/
814 o 0:4a2df7238c3b A
815
816
817 $ hg rebase -d 'desc(B2)'
818 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
819 rebasing 5:1a79b7535141 tip "D"
820 $ hg up 4
821 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
822 $ echo "O" > O
823 $ hg add O
824 $ hg commit -m O
825 $ echo "P" > P
826 $ hg add P
827 $ hg commit -m P
828 $ hg log -G
829 @ 8:8d47583e023f P
830 |
831 o 7:360bbaa7d3ce O
832 |
833 | o 6:9c48361117de D
834 | |
835 o | 4:ff2c4d47b71d C
836 |/
837 o 2:261e70097290 B2
838 |
839 o 0:4a2df7238c3b A
840
841 $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=true
842 1 new obsolescence markers
843 obsoleted 1 changesets
844 1 new orphan changesets
845 $ hg rebase -d 6 -r "4::"
846 rebasing 4:ff2c4d47b71d "C"
847 note: not rebasing 7:360bbaa7d3ce "O", it has no successor
848 rebasing 8:8d47583e023f tip "P"
849
850 If all the changeset to be rebased are obsolete and present in the destination, we
851 should display a friendly error message
852
853 $ hg log -G
854 @ 10:121d9e3bc4c6 P
855 |
856 o 9:4be60e099a77 C
857 |
858 o 6:9c48361117de D
859 |
860 o 2:261e70097290 B2
861 |
862 o 0:4a2df7238c3b A
863
864
865 $ hg up 9
866 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
867 $ echo "non-relevant change" > nonrelevant
868 $ hg add nonrelevant
869 $ hg commit -m nonrelevant
870 created new head
871 $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=true
872 1 new obsolescence markers
873 obsoleted 1 changesets
874 $ hg log -G
875 @ 11:f44da1f4954c nonrelevant (pruned)
876 |
877 | o 10:121d9e3bc4c6 P
878 |/
879 o 9:4be60e099a77 C
880 |
881 o 6:9c48361117de D
882 |
883 o 2:261e70097290 B2
884 |
885 o 0:4a2df7238c3b A
886
887 $ hg rebase -r . -d 10
888 note: not rebasing 11:f44da1f4954c tip "nonrelevant", it has no successor
889
890 If a rebase is going to create divergence, it should abort
891
892 $ hg log -G
893 @ 10:121d9e3bc4c6 P
894 |
895 o 9:4be60e099a77 C
896 |
897 o 6:9c48361117de D
898 |
899 o 2:261e70097290 B2
900 |
901 o 0:4a2df7238c3b A
902
903
904 $ hg up 9
905 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
906 $ echo "john" > doe
907 $ hg add doe
908 $ hg commit -m "john doe"
909 created new head
910 $ hg up 10
911 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
912 $ echo "foo" > bar
913 $ hg add bar
914 $ hg commit --amend -m "10'"
915 $ hg up 10 --hidden
916 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
917 updated to hidden changeset 121d9e3bc4c6
918 (hidden revision '121d9e3bc4c6' was rewritten as: 77d874d096a2)
919 $ echo "bar" > foo
920 $ hg add foo
921 $ hg commit -m "bar foo"
922 1 new orphan changesets
923 $ hg log -G
924 @ 14:73568ab6879d bar foo
925 |
926 | o 13:77d874d096a2 10'
927 | |
928 | | o 12:3eb461388009 john doe
929 | |/
930 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
931 |/
932 o 9:4be60e099a77 C
933 |
934 o 6:9c48361117de D
935 |
936 o 2:261e70097290 B2
937 |
938 o 0:4a2df7238c3b A
939
940 $ hg summary
941 parent: 14:73568ab6879d tip (orphan)
942 bar foo
943 branch: default
944 commit: (clean)
945 update: 2 new changesets, 3 branch heads (merge)
946 phases: 8 draft
947 orphan: 1 changesets
948 $ hg rebase -s 10 -d 12
949 abort: this rebase will cause divergences from: 121d9e3bc4c6
950 (to force the rebase please set experimental.evolution.allowdivergence=True)
951 [20]
952 $ hg log -G
953 @ 14:73568ab6879d bar foo
954 |
955 | o 13:77d874d096a2 10'
956 | |
957 | | o 12:3eb461388009 john doe
958 | |/
959 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
960 |/
961 o 9:4be60e099a77 C
962 |
963 o 6:9c48361117de D
964 |
965 o 2:261e70097290 B2
966 |
967 o 0:4a2df7238c3b A
968
969 With experimental.evolution.allowdivergence=True, rebase can create divergence
970
971 $ hg rebase -s 10 -d 12 --config experimental.evolution.allowdivergence=True
972 rebasing 10:121d9e3bc4c6 "P"
973 rebasing 14:73568ab6879d tip "bar foo"
974 2 new content-divergent changesets
975 $ hg summary
976 parent: 16:61bd55f69bc4 tip
977 bar foo
978 branch: default
979 commit: (clean)
980 update: 1 new changesets, 2 branch heads (merge)
981 phases: 8 draft
982 content-divergent: 2 changesets
983
984 rebase --continue + skipped rev because their successors are in destination
985 we make a change in trunk and work on conflicting changes to make rebase abort.
986
987 $ hg log -G -r 16::
988 @ 16:61bd55f69bc4 bar foo
989 |
990 ~
991
992 Create the two changes in trunk
993 $ printf "a" > willconflict
994 $ hg add willconflict
995 $ hg commit -m "willconflict first version"
996
997 $ printf "dummy" > C
998 $ hg commit -m "dummy change successor"
999
1000 Create the changes that we will rebase
1001 $ hg update -C 16 -q
1002 $ printf "b" > willconflict
1003 $ hg add willconflict
1004 $ hg commit -m "willconflict second version"
1005 created new head
1006 $ printf "dummy" > K
1007 $ hg add K
1008 $ hg commit -m "dummy change"
1009 $ printf "dummy" > L
1010 $ hg add L
1011 $ hg commit -m "dummy change"
1012 $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 18 -T '{node}'` --config experimental.evolution=true
1013 1 new obsolescence markers
1014 obsoleted 1 changesets
1015 1 new orphan changesets
1016
1017 $ hg log -G -r 16::
1018 @ 21:7bdc8a87673d dummy change
1019 |
1020 x 20:8b31da3c4919 dummy change (rewritten as 18:601db7a18f51)
1021 |
1022 o 19:b82fb57ea638 willconflict second version
1023 |
1024 | o 18:601db7a18f51 dummy change successor
1025 | |
1026 | o 17:357ddf1602d5 willconflict first version
1027 |/
1028 o 16:61bd55f69bc4 bar foo
1029 |
1030 ~
1031 $ hg rebase -r ".^^ + .^ + ." -d 18
1032 rebasing 19:b82fb57ea638 "willconflict second version"
1033 merging willconflict
1034 warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark')
1035 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1036 [240]
1037
1038 $ hg resolve --mark willconflict
1039 (no more unresolved files)
1040 continue: hg rebase --continue
1041 $ hg rebase --continue
1042 rebasing 19:b82fb57ea638 "willconflict second version"
1043 note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
1044 rebasing 21:7bdc8a87673d tip "dummy change"
1045 $ cd ..
1046
1047 Divergence cases due to obsolete changesets
21 Divergence cases due to obsolete changesets
1048 -------------------------------------------
22 -------------------------------------------
1049
23
@@ -1650,489 +624,3 b' parent moves as requested.'
1650 Z
624 Z
1651
625
1652 $ cd ..
626 $ cd ..
1653
1654 Test that bookmark is moved and working dir is updated when all changesets have
1655 equivalents in destination
1656 $ hg init rbsrepo && cd rbsrepo
1657 $ echo "[experimental]" > .hg/hgrc
1658 $ echo "evolution=true" >> .hg/hgrc
1659 $ echo "rebaseskipobsolete=on" >> .hg/hgrc
1660 $ echo root > root && hg ci -Am root
1661 adding root
1662 $ echo a > a && hg ci -Am a
1663 adding a
1664 $ hg up 0
1665 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1666 $ echo b > b && hg ci -Am b
1667 adding b
1668 created new head
1669 $ hg rebase -r 2 -d 1
1670 rebasing 2:1e9a3c00cbe9 tip "b"
1671 $ hg log -r . # working dir is at rev 3 (successor of 2)
1672 3:be1832deae9a b (no-eol)
1673 $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now
1674 bookmarking hidden changeset 1e9a3c00cbe9
1675 (hidden revision '1e9a3c00cbe9' was rewritten as: be1832deae9a)
1676 $ hg up 2 && hg log -r . # working dir is at rev 2 again
1677 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1678 2:1e9a3c00cbe9 b (rewritten using rebase as 3:be1832deae9a) (no-eol)
1679 $ hg rebase -r 2 -d 3 --config experimental.evolution.track-operation=1
1680 note: not rebasing 2:1e9a3c00cbe9 mybook "b", already in destination as 3:be1832deae9a tip "b"
1681 Check that working directory and bookmark was updated to rev 3 although rev 2
1682 was skipped
1683 $ hg log -r .
1684 3:be1832deae9a b (no-eol)
1685 $ hg bookmarks
1686 mybook 3:be1832deae9a
1687 $ hg debugobsolete --rev tip
1688 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
1689
1690 Obsoleted working parent and bookmark could be moved if an ancestor of working
1691 parent gets moved:
1692
1693 $ hg init $TESTTMP/ancestor-wd-move
1694 $ cd $TESTTMP/ancestor-wd-move
1695 $ hg debugdrawdag <<'EOS'
1696 > E D1 # rebase: D1 -> D2
1697 > | |
1698 > | C
1699 > D2 |
1700 > | B
1701 > |/
1702 > A
1703 > EOS
1704 $ hg update D1 -q
1705 $ hg bookmark book -i
1706 $ hg rebase -r B+D1 -d E
1707 rebasing 1:112478962961 B "B"
1708 note: not rebasing 5:15ecf15e0114 book D1 tip "D1", already in destination as 2:0807738e0be9 D2 "D2"
1709 1 new orphan changesets
1710 $ hg log -G -T '{desc} {bookmarks}'
1711 @ B book
1712 |
1713 | x D1
1714 | |
1715 o | E
1716 | |
1717 | * C
1718 | |
1719 o | D2
1720 | |
1721 | x B
1722 |/
1723 o A
1724
1725 Rebasing a merge with one of its parent having a hidden successor
1726
1727 $ hg init $TESTTMP/merge-p1-hidden-successor
1728 $ cd $TESTTMP/merge-p1-hidden-successor
1729
1730 $ hg debugdrawdag <<'EOS'
1731 > E
1732 > |
1733 > B3 B2 # amend: B1 -> B2 -> B3
1734 > |/ # B2 is hidden
1735 > | D
1736 > | |\
1737 > | B1 C
1738 > |/
1739 > A
1740 > EOS
1741 1 new orphan changesets
1742
1743 $ eval `hg tags -T '{tag}={node}\n'`
1744 $ rm .hg/localtags
1745
1746 $ hg rebase -r $D -d $E
1747 rebasing 5:9e62094e4d94 "D"
1748
1749 $ hg log -G
1750 o 7:a699d059adcf D
1751 |\
1752 | o 6:ecc93090a95c E
1753 | |
1754 | o 4:0dc878468a23 B3
1755 | |
1756 o | 1:96cc3511f894 C
1757 /
1758 o 0:426bada5c675 A
1759
1760 For some reasons (--hidden, rebaseskipobsolete=0, directaccess, etc.),
1761 rebasestate may contain hidden hashes. "rebase --abort" should work regardless.
1762
1763 $ hg init $TESTTMP/hidden-state1
1764 $ cd $TESTTMP/hidden-state1
1765 $ cat >> .hg/hgrc <<EOF
1766 > [experimental]
1767 > rebaseskipobsolete=0
1768 > EOF
1769
1770 $ hg debugdrawdag <<'EOS'
1771 > C
1772 > |
1773 > D B # prune: B, C
1774 > |/ # B/D=B
1775 > A
1776 > EOS
1777
1778 $ eval `hg tags -T '{tag}={node}\n'`
1779 $ rm .hg/localtags
1780
1781 $ hg update -q $C --hidden
1782 updated to hidden changeset 7829726be4dc
1783 (hidden revision '7829726be4dc' is pruned)
1784 $ hg rebase -s $B -d $D
1785 rebasing 1:2ec65233581b "B"
1786 merging D
1787 warning: conflicts while merging D! (edit, then use 'hg resolve --mark')
1788 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1789 [240]
1790
1791 $ cp -R . $TESTTMP/hidden-state2
1792
1793 $ hg log -G
1794 @ 2:b18e25de2cf5 D
1795 |
1796 | % 1:2ec65233581b B (pruned using prune)
1797 |/
1798 o 0:426bada5c675 A
1799
1800 $ hg summary
1801 parent: 2:b18e25de2cf5 tip
1802 D
1803 branch: default
1804 commit: 1 modified, 1 added, 1 unknown, 1 unresolved
1805 update: 1 new changesets, 2 branch heads (merge)
1806 phases: 3 draft
1807 rebase: 0 rebased, 2 remaining (rebase --continue)
1808
1809 $ hg rebase --abort
1810 rebase aborted
1811
1812 Also test --continue for the above case
1813
1814 $ cd $TESTTMP/hidden-state2
1815 $ hg resolve -m
1816 (no more unresolved files)
1817 continue: hg rebase --continue
1818 $ hg rebase --continue
1819 rebasing 1:2ec65233581b "B"
1820 rebasing 3:7829726be4dc tip "C"
1821 $ hg log -G
1822 @ 5:1964d5d5b547 C
1823 |
1824 o 4:68deb90c12a2 B
1825 |
1826 o 2:b18e25de2cf5 D
1827 |
1828 o 0:426bada5c675 A
1829
1830 ====================
1831 Test --stop option |
1832 ====================
1833 $ cd ..
1834 $ hg init rbstop
1835 $ cd rbstop
1836 $ echo a>a
1837 $ hg ci -Aqma
1838 $ echo b>b
1839 $ hg ci -Aqmb
1840 $ echo c>c
1841 $ hg ci -Aqmc
1842 $ echo d>d
1843 $ hg ci -Aqmd
1844 $ hg up 0 -q
1845 $ echo f>f
1846 $ hg ci -Aqmf
1847 $ echo D>d
1848 $ hg ci -Aqm "conflict with d"
1849 $ hg up 3 -q
1850 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1851 o 5:00bfc9898aeb test
1852 | conflict with d
1853 |
1854 o 4:dafd40200f93 test
1855 | f
1856 |
1857 | @ 3:055a42cdd887 test
1858 | | d
1859 | |
1860 | o 2:177f92b77385 test
1861 | | c
1862 | |
1863 | o 1:d2ae7f538514 test
1864 |/ b
1865 |
1866 o 0:cb9a9f314b8b test
1867 a
1868
1869 $ hg rebase -s 1 -d 5
1870 rebasing 1:d2ae7f538514 "b"
1871 rebasing 2:177f92b77385 "c"
1872 rebasing 3:055a42cdd887 "d"
1873 merging d
1874 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1875 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1876 [240]
1877 $ hg rebase --stop
1878 1 new orphan changesets
1879 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1880 o 7:7fffad344617 test
1881 | c
1882 |
1883 o 6:b15528633407 test
1884 | b
1885 |
1886 o 5:00bfc9898aeb test
1887 | conflict with d
1888 |
1889 o 4:dafd40200f93 test
1890 | f
1891 |
1892 | @ 3:055a42cdd887 test
1893 | | d
1894 | |
1895 | x 2:177f92b77385 test
1896 | | c
1897 | |
1898 | x 1:d2ae7f538514 test
1899 |/ b
1900 |
1901 o 0:cb9a9f314b8b test
1902 a
1903
1904 Test it aborts if unstable csets is not allowed:
1905 ===============================================
1906 $ cat >> $HGRCPATH << EOF
1907 > [experimental]
1908 > evolution.allowunstable=False
1909 > EOF
1910
1911 $ hg strip 6 --no-backup -q
1912 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1913 o 5:00bfc9898aeb test
1914 | conflict with d
1915 |
1916 o 4:dafd40200f93 test
1917 | f
1918 |
1919 | @ 3:055a42cdd887 test
1920 | | d
1921 | |
1922 | o 2:177f92b77385 test
1923 | | c
1924 | |
1925 | o 1:d2ae7f538514 test
1926 |/ b
1927 |
1928 o 0:cb9a9f314b8b test
1929 a
1930
1931 $ hg rebase -s 1 -d 5
1932 rebasing 1:d2ae7f538514 "b"
1933 rebasing 2:177f92b77385 "c"
1934 rebasing 3:055a42cdd887 "d"
1935 merging d
1936 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1937 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1938 [240]
1939 $ hg rebase --stop
1940 abort: cannot remove original changesets with unrebased descendants
1941 (either enable obsmarkers to allow unstable revisions or use --keep to keep original changesets)
1942 [20]
1943 $ hg rebase --abort
1944 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1945 rebase aborted
1946
1947 Test --stop when --keep is passed:
1948 ==================================
1949 $ hg rebase -s 1 -d 5 --keep
1950 rebasing 1:d2ae7f538514 "b"
1951 rebasing 2:177f92b77385 "c"
1952 rebasing 3:055a42cdd887 "d"
1953 merging d
1954 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1955 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1956 [240]
1957 $ hg rebase --stop
1958 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1959 o 7:7fffad344617 test
1960 | c
1961 |
1962 o 6:b15528633407 test
1963 | b
1964 |
1965 o 5:00bfc9898aeb test
1966 | conflict with d
1967 |
1968 o 4:dafd40200f93 test
1969 | f
1970 |
1971 | @ 3:055a42cdd887 test
1972 | | d
1973 | |
1974 | o 2:177f92b77385 test
1975 | | c
1976 | |
1977 | o 1:d2ae7f538514 test
1978 |/ b
1979 |
1980 o 0:cb9a9f314b8b test
1981 a
1982
1983 Test --stop aborts when --collapse was passed:
1984 =============================================
1985 $ cat >> $HGRCPATH << EOF
1986 > [experimental]
1987 > evolution.allowunstable=True
1988 > EOF
1989
1990 $ hg strip 6
1991 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1992 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1993 o 5:00bfc9898aeb test
1994 | conflict with d
1995 |
1996 o 4:dafd40200f93 test
1997 | f
1998 |
1999 | @ 3:055a42cdd887 test
2000 | | d
2001 | |
2002 | o 2:177f92b77385 test
2003 | | c
2004 | |
2005 | o 1:d2ae7f538514 test
2006 |/ b
2007 |
2008 o 0:cb9a9f314b8b test
2009 a
2010
2011 $ hg rebase -s 1 -d 5 --collapse -m "collapsed b c d"
2012 rebasing 1:d2ae7f538514 "b"
2013 rebasing 2:177f92b77385 "c"
2014 rebasing 3:055a42cdd887 "d"
2015 merging d
2016 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2017 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2018 [240]
2019 $ hg rebase --stop
2020 abort: cannot stop in --collapse session
2021 [20]
2022 $ hg rebase --abort
2023 rebase aborted
2024 $ hg diff
2025 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
2026 o 5:00bfc9898aeb test
2027 | conflict with d
2028 |
2029 o 4:dafd40200f93 test
2030 | f
2031 |
2032 | @ 3:055a42cdd887 test
2033 | | d
2034 | |
2035 | o 2:177f92b77385 test
2036 | | c
2037 | |
2038 | o 1:d2ae7f538514 test
2039 |/ b
2040 |
2041 o 0:cb9a9f314b8b test
2042 a
2043
2044 Test --stop raise errors with conflicting options:
2045 =================================================
2046 $ hg rebase -s 3 -d 5
2047 rebasing 3:055a42cdd887 "d"
2048 merging d
2049 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2050 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2051 [240]
2052 $ hg rebase --stop --dry-run
2053 abort: cannot specify both --stop and --dry-run
2054 [10]
2055
2056 $ hg rebase -s 3 -d 5
2057 abort: rebase in progress
2058 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
2059 [20]
2060 $ hg rebase --stop --continue
2061 abort: cannot specify both --stop and --continue
2062 [10]
2063
2064 Test --stop moves bookmarks of original revisions to new rebased nodes:
2065 ======================================================================
2066 $ cd ..
2067 $ hg init repo
2068 $ cd repo
2069
2070 $ echo a > a
2071 $ hg ci -Am A
2072 adding a
2073
2074 $ echo b > b
2075 $ hg ci -Am B
2076 adding b
2077 $ hg book X
2078 $ hg book Y
2079
2080 $ echo c > c
2081 $ hg ci -Am C
2082 adding c
2083 $ hg book Z
2084
2085 $ echo d > d
2086 $ hg ci -Am D
2087 adding d
2088
2089 $ hg up 0 -q
2090 $ echo e > e
2091 $ hg ci -Am E
2092 adding e
2093 created new head
2094
2095 $ echo doubt > d
2096 $ hg ci -Am "conflict with d"
2097 adding d
2098
2099 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2100 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2101 |
2102 o 4: 9c1e55f411b6 'E' bookmarks:
2103 |
2104 | o 3: 67a385d4e6f2 'D' bookmarks: Z
2105 | |
2106 | o 2: 49cb3485fa0c 'C' bookmarks: Y
2107 | |
2108 | o 1: 6c81ed0049f8 'B' bookmarks: X
2109 |/
2110 o 0: 1994f17a630e 'A' bookmarks:
2111
2112 $ hg rebase -s 1 -d 5
2113 rebasing 1:6c81ed0049f8 X "B"
2114 rebasing 2:49cb3485fa0c Y "C"
2115 rebasing 3:67a385d4e6f2 Z "D"
2116 merging d
2117 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2118 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2119 [240]
2120 $ hg rebase --stop
2121 1 new orphan changesets
2122 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2123 o 7: 9c86c650b686 'C' bookmarks: Y
2124 |
2125 o 6: 9b87b54e5fd8 'B' bookmarks: X
2126 |
2127 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2128 |
2129 o 4: 9c1e55f411b6 'E' bookmarks:
2130 |
2131 | * 3: 67a385d4e6f2 'D' bookmarks: Z
2132 | |
2133 | x 2: 49cb3485fa0c 'C' bookmarks:
2134 | |
2135 | x 1: 6c81ed0049f8 'B' bookmarks:
2136 |/
2137 o 0: 1994f17a630e 'A' bookmarks:
2138
This diff has been collapsed as it changes many lines, (1633 lines changed) Show them Hide them
@@ -18,1639 +18,6 b' Enable obsolete'
18 > strip=
18 > strip=
19 > EOF
19 > EOF
20
20
21 Setup rebase canonical repo
22
23 $ hg init base
24 $ cd base
25 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
26 adding changesets
27 adding manifests
28 adding file changes
29 added 8 changesets with 7 changes to 7 files (+2 heads)
30 new changesets cd010b8cd998:02de42196ebe (8 drafts)
31 (run 'hg heads' to see heads, 'hg merge' to merge)
32 $ hg up tip
33 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ hg log -G
35 @ 7:02de42196ebe H
36 |
37 | o 6:eea13746799a G
38 |/|
39 o | 5:24b6387c8c8c F
40 | |
41 | o 4:9520eea781bc E
42 |/
43 | o 3:32af7686d403 D
44 | |
45 | o 2:5fddd98957c8 C
46 | |
47 | o 1:42ccdea3bb16 B
48 |/
49 o 0:cd010b8cd998 A
50
51 $ cd ..
52
53 simple rebase
54 ---------------------------------
55
56 $ hg clone base simple
57 updating to branch default
58 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 $ cd simple
60 $ hg up 32af7686d403
61 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
62 $ hg rebase -d eea13746799a
63 rebasing 1:42ccdea3bb16 "B"
64 rebasing 2:5fddd98957c8 "C"
65 rebasing 3:32af7686d403 "D"
66 $ hg log -G
67 @ 10:8eeb3c33ad33 D
68 |
69 o 9:2327fea05063 C
70 |
71 o 8:e4e5be0395b2 B
72 |
73 | o 7:02de42196ebe H
74 | |
75 o | 6:eea13746799a G
76 |\|
77 | o 5:24b6387c8c8c F
78 | |
79 o | 4:9520eea781bc E
80 |/
81 o 0:cd010b8cd998 A
82
83 $ hg log --hidden -G
84 @ 10:8eeb3c33ad33 D
85 |
86 o 9:2327fea05063 C
87 |
88 o 8:e4e5be0395b2 B
89 |
90 | o 7:02de42196ebe H
91 | |
92 o | 6:eea13746799a G
93 |\|
94 | o 5:24b6387c8c8c F
95 | |
96 o | 4:9520eea781bc E
97 |/
98 | x 3:32af7686d403 D (rewritten using rebase as 10:8eeb3c33ad33)
99 | |
100 | x 2:5fddd98957c8 C (rewritten using rebase as 9:2327fea05063)
101 | |
102 | x 1:42ccdea3bb16 B (rewritten using rebase as 8:e4e5be0395b2)
103 |/
104 o 0:cd010b8cd998 A
105
106 $ hg debugobsolete
107 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
108 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
109 32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
110
111
112 $ cd ..
113
114 empty changeset
115 ---------------------------------
116
117 $ hg clone base empty
118 updating to branch default
119 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 $ cd empty
121 $ hg up eea13746799a
122 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
123
124 We make a copy of both the first changeset in the rebased and some other in the
125 set.
126
127 $ hg graft 42ccdea3bb16 32af7686d403
128 grafting 1:42ccdea3bb16 "B"
129 grafting 3:32af7686d403 "D"
130 $ hg rebase -s 42ccdea3bb16 -d .
131 rebasing 1:42ccdea3bb16 "B"
132 note: not rebasing 1:42ccdea3bb16 "B", its destination already has all its changes
133 rebasing 2:5fddd98957c8 "C"
134 rebasing 3:32af7686d403 "D"
135 note: not rebasing 3:32af7686d403 "D", its destination already has all its changes
136 $ hg log -G
137 o 10:5ae4c968c6ac C
138 |
139 @ 9:08483444fef9 D
140 |
141 o 8:8877864f1edb B
142 |
143 | o 7:02de42196ebe H
144 | |
145 o | 6:eea13746799a G
146 |\|
147 | o 5:24b6387c8c8c F
148 | |
149 o | 4:9520eea781bc E
150 |/
151 o 0:cd010b8cd998 A
152
153 $ hg log --hidden -G
154 o 10:5ae4c968c6ac C
155 |
156 @ 9:08483444fef9 D
157 |
158 o 8:8877864f1edb B
159 |
160 | o 7:02de42196ebe H
161 | |
162 o | 6:eea13746799a G
163 |\|
164 | o 5:24b6387c8c8c F
165 | |
166 o | 4:9520eea781bc E
167 |/
168 | x 3:32af7686d403 D (pruned using rebase)
169 | |
170 | x 2:5fddd98957c8 C (rewritten using rebase as 10:5ae4c968c6ac)
171 | |
172 | x 1:42ccdea3bb16 B (pruned using rebase)
173 |/
174 o 0:cd010b8cd998 A
175
176 $ hg debugobsolete
177 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
178 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
179 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
180
181
182 More complex case where part of the rebase set were already rebased
183
184 $ hg rebase --rev 'desc(D)' --dest 'desc(H)'
185 rebasing 9:08483444fef9 "D"
186 1 new orphan changesets
187 $ hg debugobsolete
188 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
189 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
190 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
191 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
192 $ hg log -G
193 @ 11:4596109a6a43 D
194 |
195 | * 10:5ae4c968c6ac C
196 | |
197 | x 9:08483444fef9 D (rewritten using rebase as 11:4596109a6a43)
198 | |
199 | o 8:8877864f1edb B
200 | |
201 o | 7:02de42196ebe H
202 | |
203 | o 6:eea13746799a G
204 |/|
205 o | 5:24b6387c8c8c F
206 | |
207 | o 4:9520eea781bc E
208 |/
209 o 0:cd010b8cd998 A
210
211 $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True
212 rebasing 8:8877864f1edb "B"
213 note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 tip "D"
214 rebasing 10:5ae4c968c6ac "C"
215 $ hg debugobsolete
216 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
217 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
218 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
219 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
220 8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
221 5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
222 $ hg log --rev 'contentdivergent()'
223 $ hg log -G
224 o 13:98f6af4ee953 C
225 |
226 o 12:462a34d07e59 B
227 |
228 @ 11:4596109a6a43 D
229 |
230 o 7:02de42196ebe H
231 |
232 | o 6:eea13746799a G
233 |/|
234 o | 5:24b6387c8c8c F
235 | |
236 | o 4:9520eea781bc E
237 |/
238 o 0:cd010b8cd998 A
239
240 $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003
241 changeset: 11:4596109a6a4328c398bde3a4a3b6737cfade3003
242 phase: draft
243 parent: 7:02de42196ebee42ef284b6780a87cdc96e8eaab6
244 parent: -1:0000000000000000000000000000000000000000
245 manifest: 11:a91006e3a02f1edf631f7018e6e5684cf27dd905
246 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
247 date: Sat Apr 30 15:24:48 2011 +0200
248 files+: D
249 extra: branch=default
250 extra: rebase_source=08483444fef91d6224f6655ee586a65d263ad34c
251 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
252 description:
253 D
254
255
256 $ hg up -qr 'desc(G)'
257 $ hg graft 4596109a6a4328c398bde3a4a3b6737cfade3003
258 grafting 11:4596109a6a43 "D"
259 $ hg up -qr 'desc(E)'
260 $ hg rebase -s tip -d .
261 rebasing 14:9e36056a46e3 tip "D"
262 $ hg log --style default --debug -r tip
263 changeset: 15:627d4614809036ba22b9e7cb31638ddc06ab99ab
264 tag: tip
265 phase: draft
266 parent: 4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba
267 parent: -1:0000000000000000000000000000000000000000
268 manifest: 15:648e8ede73ae3e497d093d3a4c8fcc2daa864f42
269 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
270 date: Sat Apr 30 15:24:48 2011 +0200
271 files+: D
272 extra: branch=default
273 extra: intermediate-source=4596109a6a4328c398bde3a4a3b6737cfade3003
274 extra: rebase_source=9e36056a46e37c9776168c7375734eebc70e294f
275 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
276 description:
277 D
278
279
280 Start rebase from a commit that is obsolete but not hidden only because it's
281 a working copy parent. We should be moved back to the starting commit as usual
282 even though it is hidden (until we're moved there).
283
284 $ hg --hidden up -qr 'first(hidden())'
285 updated to hidden changeset 42ccdea3bb16
286 (hidden revision '42ccdea3bb16' is pruned)
287 $ hg rebase --rev 13 --dest 15
288 rebasing 13:98f6af4ee953 "C"
289 $ hg log -G
290 o 16:294a2b93eb4d C
291 |
292 o 15:627d46148090 D
293 |
294 | o 12:462a34d07e59 B
295 | |
296 | o 11:4596109a6a43 D
297 | |
298 | o 7:02de42196ebe H
299 | |
300 +---o 6:eea13746799a G
301 | |/
302 | o 5:24b6387c8c8c F
303 | |
304 o | 4:9520eea781bc E
305 |/
306 | @ 1:42ccdea3bb16 B (pruned using rebase)
307 |/
308 o 0:cd010b8cd998 A
309
310
311 $ cd ..
312
313 collapse rebase
314 ---------------------------------
315
316 $ hg clone base collapse
317 updating to branch default
318 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
319 $ cd collapse
320 $ hg rebase -s 42ccdea3bb16 -d eea13746799a --collapse
321 rebasing 1:42ccdea3bb16 "B"
322 rebasing 2:5fddd98957c8 "C"
323 rebasing 3:32af7686d403 "D"
324 $ hg log -G
325 o 8:4dc2197e807b Collapsed revision
326 |
327 | @ 7:02de42196ebe H
328 | |
329 o | 6:eea13746799a G
330 |\|
331 | o 5:24b6387c8c8c F
332 | |
333 o | 4:9520eea781bc E
334 |/
335 o 0:cd010b8cd998 A
336
337 $ hg log --hidden -G
338 o 8:4dc2197e807b Collapsed revision
339 |
340 | @ 7:02de42196ebe H
341 | |
342 o | 6:eea13746799a G
343 |\|
344 | o 5:24b6387c8c8c F
345 | |
346 o | 4:9520eea781bc E
347 |/
348 | x 3:32af7686d403 D (rewritten using rebase as 8:4dc2197e807b)
349 | |
350 | x 2:5fddd98957c8 C (rewritten using rebase as 8:4dc2197e807b)
351 | |
352 | x 1:42ccdea3bb16 B (rewritten using rebase as 8:4dc2197e807b)
353 |/
354 o 0:cd010b8cd998 A
355
356 $ hg id --debug -r tip
357 4dc2197e807bae9817f09905b50ab288be2dbbcf tip
358 $ hg debugobsolete
359 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '1', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
360 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '2', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
361 32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '3', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
362
363 $ cd ..
364
365 Rebase set has hidden descendants
366 ---------------------------------
367
368 We rebase a changeset which has hidden descendants. Hidden changesets must not
369 be rebased.
370
371 $ hg clone base hidden
372 updating to branch default
373 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
374 $ cd hidden
375 $ hg log -G
376 @ 7:02de42196ebe H
377 |
378 | o 6:eea13746799a G
379 |/|
380 o | 5:24b6387c8c8c F
381 | |
382 | o 4:9520eea781bc E
383 |/
384 | o 3:32af7686d403 D
385 | |
386 | o 2:5fddd98957c8 C
387 | |
388 | o 1:42ccdea3bb16 B
389 |/
390 o 0:cd010b8cd998 A
391
392 $ hg rebase -s 5fddd98957c8 -d eea13746799a
393 rebasing 2:5fddd98957c8 "C"
394 rebasing 3:32af7686d403 "D"
395 $ hg log -G
396 o 9:cf44d2f5a9f4 D
397 |
398 o 8:e273c5e7d2d2 C
399 |
400 | @ 7:02de42196ebe H
401 | |
402 o | 6:eea13746799a G
403 |\|
404 | o 5:24b6387c8c8c F
405 | |
406 o | 4:9520eea781bc E
407 |/
408 | o 1:42ccdea3bb16 B
409 |/
410 o 0:cd010b8cd998 A
411
412 $ hg rebase -s 42ccdea3bb16 -d 02de42196ebe
413 rebasing 1:42ccdea3bb16 "B"
414 $ hg log -G
415 o 10:7c6027df6a99 B
416 |
417 | o 9:cf44d2f5a9f4 D
418 | |
419 | o 8:e273c5e7d2d2 C
420 | |
421 @ | 7:02de42196ebe H
422 | |
423 | o 6:eea13746799a G
424 |/|
425 o | 5:24b6387c8c8c F
426 | |
427 | o 4:9520eea781bc E
428 |/
429 o 0:cd010b8cd998 A
430
431 $ hg log --hidden -G
432 o 10:7c6027df6a99 B
433 |
434 | o 9:cf44d2f5a9f4 D
435 | |
436 | o 8:e273c5e7d2d2 C
437 | |
438 @ | 7:02de42196ebe H
439 | |
440 | o 6:eea13746799a G
441 |/|
442 o | 5:24b6387c8c8c F
443 | |
444 | o 4:9520eea781bc E
445 |/
446 | x 3:32af7686d403 D (rewritten using rebase as 9:cf44d2f5a9f4)
447 | |
448 | x 2:5fddd98957c8 C (rewritten using rebase as 8:e273c5e7d2d2)
449 | |
450 | x 1:42ccdea3bb16 B (rewritten using rebase as 10:7c6027df6a99)
451 |/
452 o 0:cd010b8cd998 A
453
454 $ hg debugobsolete
455 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
456 32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
457 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
458
459 Test that rewriting leaving instability behind is allowed
460 ---------------------------------------------------------------------
461
462 $ hg log -r 'children(8)'
463 9:cf44d2f5a9f4 D (no-eol)
464 $ hg rebase -r 8
465 rebasing 8:e273c5e7d2d2 "C"
466 1 new orphan changesets
467 $ hg log -G
468 o 11:0d8f238b634c C
469 |
470 o 10:7c6027df6a99 B
471 |
472 | * 9:cf44d2f5a9f4 D
473 | |
474 | x 8:e273c5e7d2d2 C (rewritten using rebase as 11:0d8f238b634c)
475 | |
476 @ | 7:02de42196ebe H
477 | |
478 | o 6:eea13746799a G
479 |/|
480 o | 5:24b6387c8c8c F
481 | |
482 | o 4:9520eea781bc E
483 |/
484 o 0:cd010b8cd998 A
485
486 $ cd ..
487 $ cp -R hidden stabilize
488 $ cd stabilize
489 $ hg rebase --auto-orphans '0::' -d 10
490 abort: cannot specify both --auto-orphans and --dest
491 [10]
492 $ hg rebase --auto-orphans '0::'
493 rebasing 9:cf44d2f5a9f4 "D"
494 $ hg log -G
495 o 12:7e3935feaa68 D
496 |
497 o 11:0d8f238b634c C
498 |
499 o 10:7c6027df6a99 B
500 |
501 @ 7:02de42196ebe H
502 |
503 | o 6:eea13746799a G
504 |/|
505 o | 5:24b6387c8c8c F
506 | |
507 | o 4:9520eea781bc E
508 |/
509 o 0:cd010b8cd998 A
510
511
512 $ cd ../hidden
513 $ rm -r ../stabilize
514
515 Test multiple root handling
516 ------------------------------------
517
518 $ hg rebase --dest 4 --rev '7+11+9'
519 rebasing 9:cf44d2f5a9f4 "D"
520 rebasing 7:02de42196ebe "H"
521 rebasing 11:0d8f238b634c tip "C"
522 $ hg log -G
523 o 14:1e8370e38cca C
524 |
525 @ 13:bfe264faf697 H
526 |
527 | o 12:102b4c1d889b D
528 |/
529 | * 10:7c6027df6a99 B
530 | |
531 | x 7:02de42196ebe H (rewritten using rebase as 13:bfe264faf697)
532 | |
533 +---o 6:eea13746799a G
534 | |/
535 | o 5:24b6387c8c8c F
536 | |
537 o | 4:9520eea781bc E
538 |/
539 o 0:cd010b8cd998 A
540
541 $ cd ..
542
543 Detach both parents
544
545 $ hg init double-detach
546 $ cd double-detach
547
548 $ hg debugdrawdag <<EOF
549 > F
550 > /|
551 > C E
552 > | |
553 > B D G
554 > \|/
555 > A
556 > EOF
557
558 $ hg rebase -d G -r 'B + D + F'
559 rebasing 1:112478962961 B "B"
560 rebasing 2:b18e25de2cf5 D "D"
561 rebasing 6:f15c3adaf214 F tip "F"
562 abort: cannot rebase 6:f15c3adaf214 without moving at least one of its parents
563 [10]
564
565 $ cd ..
566
567 test on rebase dropping a merge
568
569 (setup)
570
571 $ hg init dropmerge
572 $ cd dropmerge
573 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
574 adding changesets
575 adding manifests
576 adding file changes
577 added 8 changesets with 7 changes to 7 files (+2 heads)
578 new changesets cd010b8cd998:02de42196ebe (8 drafts)
579 (run 'hg heads' to see heads, 'hg merge' to merge)
580 $ hg up 3
581 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
582 $ hg merge 7
583 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
584 (branch merge, don't forget to commit)
585 $ hg ci -m 'M'
586 $ echo I > I
587 $ hg add I
588 $ hg ci -m I
589 $ hg log -G
590 @ 9:4bde274eefcf I
591 |
592 o 8:53a6a128b2b7 M
593 |\
594 | o 7:02de42196ebe H
595 | |
596 | | o 6:eea13746799a G
597 | |/|
598 | o | 5:24b6387c8c8c F
599 | | |
600 | | o 4:9520eea781bc E
601 | |/
602 o | 3:32af7686d403 D
603 | |
604 o | 2:5fddd98957c8 C
605 | |
606 o | 1:42ccdea3bb16 B
607 |/
608 o 0:cd010b8cd998 A
609
610 (actual test)
611
612 $ hg rebase --dest 6 --rev '((desc(H) + desc(D))::) - desc(M)'
613 rebasing 3:32af7686d403 "D"
614 rebasing 7:02de42196ebe "H"
615 rebasing 9:4bde274eefcf tip "I"
616 1 new orphan changesets
617 $ hg log -G
618 @ 12:acd174b7ab39 I
619 |
620 o 11:6c11a6218c97 H
621 |
622 | o 10:b5313c85b22e D
623 |/
624 | * 8:53a6a128b2b7 M
625 | |\
626 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
627 | | |
628 o---+ 6:eea13746799a G
629 | | |
630 | | o 5:24b6387c8c8c F
631 | | |
632 o---+ 4:9520eea781bc E
633 / /
634 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
635 | |
636 o | 2:5fddd98957c8 C
637 | |
638 o | 1:42ccdea3bb16 B
639 |/
640 o 0:cd010b8cd998 A
641
642
643 Test hidden changesets in the rebase set (issue4504)
644
645 $ hg up --hidden 9
646 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
647 updated to hidden changeset 4bde274eefcf
648 (hidden revision '4bde274eefcf' was rewritten as: acd174b7ab39)
649 $ echo J > J
650 $ hg add J
651 $ hg commit -m J
652 1 new orphan changesets
653 $ hg debugobsolete `hg log --rev . -T '{node}'`
654 1 new obsolescence markers
655 obsoleted 1 changesets
656
657 $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback --config experimental.rebaseskipobsolete=off
658 rebasing 9:4bde274eefcf "I"
659 rebasing 13:06edfc82198f tip "J"
660 2 new content-divergent changesets
661 $ hg log -G
662 @ 15:5ae8a643467b J
663 |
664 * 14:9ad579b4a5de I
665 |
666 | * 12:acd174b7ab39 I
667 | |
668 | o 11:6c11a6218c97 H
669 | |
670 o | 10:b5313c85b22e D
671 |/
672 | * 8:53a6a128b2b7 M
673 | |\
674 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
675 | | |
676 o---+ 6:eea13746799a G
677 | | |
678 | | o 5:24b6387c8c8c F
679 | | |
680 o---+ 4:9520eea781bc E
681 / /
682 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
683 | |
684 o | 2:5fddd98957c8 C
685 | |
686 o | 1:42ccdea3bb16 B
687 |/
688 o 0:cd010b8cd998 A
689
690 $ hg up 14 -C
691 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
692 $ echo "K" > K
693 $ hg add K
694 $ hg commit --amend -m "K"
695 1 new orphan changesets
696 $ echo "L" > L
697 $ hg add L
698 $ hg commit -m "L"
699 $ hg up '.^'
700 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
701 $ echo "M" > M
702 $ hg add M
703 $ hg commit --amend -m "M"
704 1 new orphan changesets
705 $ hg log -G
706 @ 18:bfaedf8eb73b M
707 |
708 | * 17:97219452e4bd L
709 | |
710 | x 16:fc37a630c901 K (rewritten using amend as 18:bfaedf8eb73b)
711 |/
712 | * 15:5ae8a643467b J
713 | |
714 | x 14:9ad579b4a5de I (rewritten using amend as 16:fc37a630c901)
715 |/
716 | * 12:acd174b7ab39 I
717 | |
718 | o 11:6c11a6218c97 H
719 | |
720 o | 10:b5313c85b22e D
721 |/
722 | * 8:53a6a128b2b7 M
723 | |\
724 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
725 | | |
726 o---+ 6:eea13746799a G
727 | | |
728 | | o 5:24b6387c8c8c F
729 | | |
730 o---+ 4:9520eea781bc E
731 / /
732 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
733 | |
734 o | 2:5fddd98957c8 C
735 | |
736 o | 1:42ccdea3bb16 B
737 |/
738 o 0:cd010b8cd998 A
739
740 $ hg rebase -s 14 -d 17 --config experimental.rebaseskipobsolete=True
741 note: not rebasing 14:9ad579b4a5de "I", already in destination as 16:fc37a630c901 "K"
742 rebasing 15:5ae8a643467b "J"
743 1 new orphan changesets
744
745 $ cd ..
746
747 Skip obsolete changeset even with multiple hops
748 -----------------------------------------------
749
750 setup
751
752 $ hg init obsskip
753 $ cd obsskip
754 $ cat << EOF >> .hg/hgrc
755 > [experimental]
756 > rebaseskipobsolete = True
757 > [extensions]
758 > strip =
759 > EOF
760 $ echo A > A
761 $ hg add A
762 $ hg commit -m A
763 $ echo B > B
764 $ hg add B
765 $ hg commit -m B0
766 $ hg commit --amend -m B1
767 $ hg commit --amend -m B2
768 $ hg up --hidden 'desc(B0)'
769 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
770 updated to hidden changeset a8b11f55fb19
771 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
772 $ echo C > C
773 $ hg add C
774 $ hg commit -m C
775 1 new orphan changesets
776 $ hg log -G
777 @ 4:212cb178bcbb C
778 |
779 | o 3:261e70097290 B2
780 | |
781 x | 1:a8b11f55fb19 B0 (rewritten using amend as 3:261e70097290)
782 |/
783 o 0:4a2df7238c3b A
784
785
786 Rebase finds its way in a chain of marker
787
788 $ hg rebase -d 'desc(B2)'
789 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
790 rebasing 4:212cb178bcbb tip "C"
791
792 Even when the chain include missing node
793
794 $ hg up --hidden 'desc(B0)'
795 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
796 updated to hidden changeset a8b11f55fb19
797 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
798 $ echo D > D
799 $ hg add D
800 $ hg commit -m D
801 1 new orphan changesets
802 $ hg --hidden strip -r 'desc(B1)'
803 saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg
804 1 new orphan changesets
805 $ hg log -G
806 @ 5:1a79b7535141 D
807 |
808 | o 4:ff2c4d47b71d C
809 | |
810 | o 2:261e70097290 B2
811 | |
812 x | 1:a8b11f55fb19 B0 (rewritten using amend as 2:261e70097290)
813 |/
814 o 0:4a2df7238c3b A
815
816
817 $ hg rebase -d 'desc(B2)'
818 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
819 rebasing 5:1a79b7535141 tip "D"
820 $ hg up 4
821 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
822 $ echo "O" > O
823 $ hg add O
824 $ hg commit -m O
825 $ echo "P" > P
826 $ hg add P
827 $ hg commit -m P
828 $ hg log -G
829 @ 8:8d47583e023f P
830 |
831 o 7:360bbaa7d3ce O
832 |
833 | o 6:9c48361117de D
834 | |
835 o | 4:ff2c4d47b71d C
836 |/
837 o 2:261e70097290 B2
838 |
839 o 0:4a2df7238c3b A
840
841 $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=true
842 1 new obsolescence markers
843 obsoleted 1 changesets
844 1 new orphan changesets
845 $ hg rebase -d 6 -r "4::"
846 rebasing 4:ff2c4d47b71d "C"
847 note: not rebasing 7:360bbaa7d3ce "O", it has no successor
848 rebasing 8:8d47583e023f tip "P"
849
850 If all the changeset to be rebased are obsolete and present in the destination, we
851 should display a friendly error message
852
853 $ hg log -G
854 @ 10:121d9e3bc4c6 P
855 |
856 o 9:4be60e099a77 C
857 |
858 o 6:9c48361117de D
859 |
860 o 2:261e70097290 B2
861 |
862 o 0:4a2df7238c3b A
863
864
865 $ hg up 9
866 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
867 $ echo "non-relevant change" > nonrelevant
868 $ hg add nonrelevant
869 $ hg commit -m nonrelevant
870 created new head
871 $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=true
872 1 new obsolescence markers
873 obsoleted 1 changesets
874 $ hg log -G
875 @ 11:f44da1f4954c nonrelevant (pruned)
876 |
877 | o 10:121d9e3bc4c6 P
878 |/
879 o 9:4be60e099a77 C
880 |
881 o 6:9c48361117de D
882 |
883 o 2:261e70097290 B2
884 |
885 o 0:4a2df7238c3b A
886
887 $ hg rebase -r . -d 10
888 note: not rebasing 11:f44da1f4954c tip "nonrelevant", it has no successor
889
890 If a rebase is going to create divergence, it should abort
891
892 $ hg log -G
893 @ 10:121d9e3bc4c6 P
894 |
895 o 9:4be60e099a77 C
896 |
897 o 6:9c48361117de D
898 |
899 o 2:261e70097290 B2
900 |
901 o 0:4a2df7238c3b A
902
903
904 $ hg up 9
905 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
906 $ echo "john" > doe
907 $ hg add doe
908 $ hg commit -m "john doe"
909 created new head
910 $ hg up 10
911 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
912 $ echo "foo" > bar
913 $ hg add bar
914 $ hg commit --amend -m "10'"
915 $ hg up 10 --hidden
916 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
917 updated to hidden changeset 121d9e3bc4c6
918 (hidden revision '121d9e3bc4c6' was rewritten as: 77d874d096a2)
919 $ echo "bar" > foo
920 $ hg add foo
921 $ hg commit -m "bar foo"
922 1 new orphan changesets
923 $ hg log -G
924 @ 14:73568ab6879d bar foo
925 |
926 | o 13:77d874d096a2 10'
927 | |
928 | | o 12:3eb461388009 john doe
929 | |/
930 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
931 |/
932 o 9:4be60e099a77 C
933 |
934 o 6:9c48361117de D
935 |
936 o 2:261e70097290 B2
937 |
938 o 0:4a2df7238c3b A
939
940 $ hg summary
941 parent: 14:73568ab6879d tip (orphan)
942 bar foo
943 branch: default
944 commit: (clean)
945 update: 2 new changesets, 3 branch heads (merge)
946 phases: 8 draft
947 orphan: 1 changesets
948 $ hg rebase -s 10 -d 12
949 abort: this rebase will cause divergences from: 121d9e3bc4c6
950 (to force the rebase please set experimental.evolution.allowdivergence=True)
951 [20]
952 $ hg log -G
953 @ 14:73568ab6879d bar foo
954 |
955 | o 13:77d874d096a2 10'
956 | |
957 | | o 12:3eb461388009 john doe
958 | |/
959 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
960 |/
961 o 9:4be60e099a77 C
962 |
963 o 6:9c48361117de D
964 |
965 o 2:261e70097290 B2
966 |
967 o 0:4a2df7238c3b A
968
969 With experimental.evolution.allowdivergence=True, rebase can create divergence
970
971 $ hg rebase -s 10 -d 12 --config experimental.evolution.allowdivergence=True
972 rebasing 10:121d9e3bc4c6 "P"
973 rebasing 14:73568ab6879d tip "bar foo"
974 2 new content-divergent changesets
975 $ hg summary
976 parent: 16:61bd55f69bc4 tip
977 bar foo
978 branch: default
979 commit: (clean)
980 update: 1 new changesets, 2 branch heads (merge)
981 phases: 8 draft
982 content-divergent: 2 changesets
983
984 rebase --continue + skipped rev because their successors are in destination
985 we make a change in trunk and work on conflicting changes to make rebase abort.
986
987 $ hg log -G -r 16::
988 @ 16:61bd55f69bc4 bar foo
989 |
990 ~
991
992 Create the two changes in trunk
993 $ printf "a" > willconflict
994 $ hg add willconflict
995 $ hg commit -m "willconflict first version"
996
997 $ printf "dummy" > C
998 $ hg commit -m "dummy change successor"
999
1000 Create the changes that we will rebase
1001 $ hg update -C 16 -q
1002 $ printf "b" > willconflict
1003 $ hg add willconflict
1004 $ hg commit -m "willconflict second version"
1005 created new head
1006 $ printf "dummy" > K
1007 $ hg add K
1008 $ hg commit -m "dummy change"
1009 $ printf "dummy" > L
1010 $ hg add L
1011 $ hg commit -m "dummy change"
1012 $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 18 -T '{node}'` --config experimental.evolution=true
1013 1 new obsolescence markers
1014 obsoleted 1 changesets
1015 1 new orphan changesets
1016
1017 $ hg log -G -r 16::
1018 @ 21:7bdc8a87673d dummy change
1019 |
1020 x 20:8b31da3c4919 dummy change (rewritten as 18:601db7a18f51)
1021 |
1022 o 19:b82fb57ea638 willconflict second version
1023 |
1024 | o 18:601db7a18f51 dummy change successor
1025 | |
1026 | o 17:357ddf1602d5 willconflict first version
1027 |/
1028 o 16:61bd55f69bc4 bar foo
1029 |
1030 ~
1031 $ hg rebase -r ".^^ + .^ + ." -d 18
1032 rebasing 19:b82fb57ea638 "willconflict second version"
1033 merging willconflict
1034 warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark')
1035 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1036 [240]
1037
1038 $ hg resolve --mark willconflict
1039 (no more unresolved files)
1040 continue: hg rebase --continue
1041 $ hg rebase --continue
1042 rebasing 19:b82fb57ea638 "willconflict second version"
1043 note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
1044 rebasing 21:7bdc8a87673d tip "dummy change"
1045 $ cd ..
1046
1047 Divergence cases due to obsolete changesets
1048 -------------------------------------------
1049
1050 We should ignore branches with unstable changesets when they are based on an
1051 obsolete changeset which successor is in rebase set.
1052
1053 $ hg init divergence
1054 $ cd divergence
1055 $ cat >> .hg/hgrc << EOF
1056 > [extensions]
1057 > strip =
1058 > [alias]
1059 > strip = strip --no-backup --quiet
1060 > [templates]
1061 > instabilities = '{rev}:{node|short} {desc|firstline}{if(instabilities," ({instabilities})")}\n'
1062 > EOF
1063
1064 $ hg debugdrawdag <<EOF
1065 > e f
1066 > | |
1067 > d' d # replace: d -> d'
1068 > \ /
1069 > c
1070 > |
1071 > x b
1072 > \|
1073 > a
1074 > EOF
1075 1 new orphan changesets
1076 $ hg log -G -r 'a'::
1077 * 7:1143e9adc121 f
1078 |
1079 | o 6:d60ebfa0f1cb e
1080 | |
1081 | o 5:027ad6c5830d d'
1082 | |
1083 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1084 |/
1085 o 3:a82ac2b38757 c
1086 |
1087 | o 2:630d7c95eff7 x
1088 | |
1089 o | 1:488e1b7e7341 b
1090 |/
1091 o 0:b173517d0057 a
1092
1093
1094 Changeset d and its descendants are excluded to avoid divergence of d, which
1095 would occur because the successor of d (d') is also in rebaseset. As a
1096 consequence f (descendant of d) is left behind.
1097
1098 $ hg rebase -b 'e' -d 'x'
1099 rebasing 1:488e1b7e7341 b "b"
1100 rebasing 3:a82ac2b38757 c "c"
1101 rebasing 5:027ad6c5830d d' "d'"
1102 rebasing 6:d60ebfa0f1cb e "e"
1103 note: not rebasing 4:76be324c128b d "d" and its descendants as this would cause divergence
1104 $ hg log -G -r 'a'::
1105 o 11:eb6d63fc4ed5 e
1106 |
1107 o 10:44d8c724a70c d'
1108 |
1109 o 9:d008e6b4d3fd c
1110 |
1111 o 8:67e8f4a16c49 b
1112 |
1113 | * 7:1143e9adc121 f
1114 | |
1115 | | x 6:d60ebfa0f1cb e (rewritten using rebase as 11:eb6d63fc4ed5)
1116 | | |
1117 | | x 5:027ad6c5830d d' (rewritten using rebase as 10:44d8c724a70c)
1118 | | |
1119 | x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1120 | |/
1121 | x 3:a82ac2b38757 c (rewritten using rebase as 9:d008e6b4d3fd)
1122 | |
1123 o | 2:630d7c95eff7 x
1124 | |
1125 | x 1:488e1b7e7341 b (rewritten using rebase as 8:67e8f4a16c49)
1126 |/
1127 o 0:b173517d0057 a
1128
1129 $ hg strip -r 8:
1130 $ hg log -G -r 'a'::
1131 * 7:1143e9adc121 f
1132 |
1133 | o 6:d60ebfa0f1cb e
1134 | |
1135 | o 5:027ad6c5830d d'
1136 | |
1137 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1138 |/
1139 o 3:a82ac2b38757 c
1140 |
1141 | o 2:630d7c95eff7 x
1142 | |
1143 o | 1:488e1b7e7341 b
1144 |/
1145 o 0:b173517d0057 a
1146
1147
1148 If the rebase set has an obsolete (d) with a successor (d') outside the rebase
1149 set and none in destination, we still get the divergence warning.
1150 By allowing divergence, we can perform the rebase.
1151
1152 $ hg rebase -r 'c'::'f' -d 'x'
1153 abort: this rebase will cause divergences from: 76be324c128b
1154 (to force the rebase please set experimental.evolution.allowdivergence=True)
1155 [20]
1156 $ hg rebase --config experimental.evolution.allowdivergence=true -r 'c'::'f' -d 'x'
1157 rebasing 3:a82ac2b38757 c "c"
1158 rebasing 4:76be324c128b d "d"
1159 rebasing 7:1143e9adc121 f tip "f"
1160 1 new orphan changesets
1161 2 new content-divergent changesets
1162 $ hg log -G -r 'a':: -T instabilities
1163 o 10:e1744ea07510 f
1164 |
1165 * 9:e2b36ea9a0a0 d (content-divergent)
1166 |
1167 o 8:6a0376de376e c
1168 |
1169 | x 7:1143e9adc121 f
1170 | |
1171 | | * 6:d60ebfa0f1cb e (orphan)
1172 | | |
1173 | | * 5:027ad6c5830d d' (orphan content-divergent)
1174 | | |
1175 | x | 4:76be324c128b d
1176 | |/
1177 | x 3:a82ac2b38757 c
1178 | |
1179 o | 2:630d7c95eff7 x
1180 | |
1181 | o 1:488e1b7e7341 b
1182 |/
1183 o 0:b173517d0057 a
1184
1185 $ hg strip -r 8:
1186
1187 (Not skipping obsoletes means that divergence is allowed.)
1188
1189 $ hg rebase --config experimental.rebaseskipobsolete=false -r 'c'::'f' -d 'x'
1190 rebasing 3:a82ac2b38757 c "c"
1191 rebasing 4:76be324c128b d "d"
1192 rebasing 7:1143e9adc121 f tip "f"
1193 1 new orphan changesets
1194 2 new content-divergent changesets
1195
1196 $ hg strip -r 0:
1197
1198 Similar test on a more complex graph
1199
1200 $ hg debugdrawdag <<EOF
1201 > g
1202 > |
1203 > f e
1204 > | |
1205 > e' d # replace: e -> e'
1206 > \ /
1207 > c
1208 > |
1209 > x b
1210 > \|
1211 > a
1212 > EOF
1213 1 new orphan changesets
1214 $ hg log -G -r 'a':
1215 * 8:2876ce66c6eb g
1216 |
1217 | o 7:3ffec603ab53 f
1218 | |
1219 x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1220 | |
1221 | o 5:63324dc512ea e'
1222 | |
1223 o | 4:76be324c128b d
1224 |/
1225 o 3:a82ac2b38757 c
1226 |
1227 | o 2:630d7c95eff7 x
1228 | |
1229 o | 1:488e1b7e7341 b
1230 |/
1231 o 0:b173517d0057 a
1232
1233 $ hg rebase -b 'f' -d 'x'
1234 rebasing 1:488e1b7e7341 b "b"
1235 rebasing 3:a82ac2b38757 c "c"
1236 rebasing 5:63324dc512ea e' "e'"
1237 rebasing 7:3ffec603ab53 f "f"
1238 rebasing 4:76be324c128b d "d"
1239 note: not rebasing 6:e36fae928aec e "e" and its descendants as this would cause divergence
1240 $ hg log -G -r 'a':
1241 o 13:a1707a5b7c2c d
1242 |
1243 | o 12:ef6251596616 f
1244 | |
1245 | o 11:b6f172e64af9 e'
1246 |/
1247 o 10:d008e6b4d3fd c
1248 |
1249 o 9:67e8f4a16c49 b
1250 |
1251 | * 8:2876ce66c6eb g
1252 | |
1253 | | x 7:3ffec603ab53 f (rewritten using rebase as 12:ef6251596616)
1254 | | |
1255 | x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1256 | | |
1257 | | x 5:63324dc512ea e' (rewritten using rebase as 11:b6f172e64af9)
1258 | | |
1259 | x | 4:76be324c128b d (rewritten using rebase as 13:a1707a5b7c2c)
1260 | |/
1261 | x 3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd)
1262 | |
1263 o | 2:630d7c95eff7 x
1264 | |
1265 | x 1:488e1b7e7341 b (rewritten using rebase as 9:67e8f4a16c49)
1266 |/
1267 o 0:b173517d0057 a
1268
1269
1270 issue5782
1271 $ hg strip -r 0:
1272 $ hg debugdrawdag <<EOF
1273 > d
1274 > |
1275 > c1 c # replace: c -> c1
1276 > \ /
1277 > b
1278 > |
1279 > a
1280 > EOF
1281 1 new orphan changesets
1282 $ hg debugobsolete `hg log -T "{node}" --hidden -r 'desc("c1")'`
1283 1 new obsolescence markers
1284 obsoleted 1 changesets
1285 $ hg log -G -r 'a': --hidden
1286 * 4:76be324c128b d
1287 |
1288 | x 3:ef8a456de8fa c1 (pruned)
1289 | |
1290 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa)
1291 |/
1292 o 1:488e1b7e7341 b
1293 |
1294 o 0:b173517d0057 a
1295
1296 $ hg rebase -d 0 -r 2
1297 note: not rebasing 2:a82ac2b38757 c "c", it has no successor
1298 $ hg log -G -r 'a': --hidden
1299 * 4:76be324c128b d
1300 |
1301 | x 3:ef8a456de8fa c1 (pruned)
1302 | |
1303 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa)
1304 |/
1305 o 1:488e1b7e7341 b
1306 |
1307 o 0:b173517d0057 a
1308
1309 $ cd ..
1310
1311 Rebase merge where successor of one parent is equal to destination (issue5198)
1312
1313 $ hg init p1-succ-is-dest
1314 $ cd p1-succ-is-dest
1315
1316 $ hg debugdrawdag <<EOF
1317 > F
1318 > /|
1319 > E D B # replace: D -> B
1320 > \|/
1321 > A
1322 > EOF
1323 1 new orphan changesets
1324
1325 $ hg rebase -d B -s D
1326 note: not rebasing 2:b18e25de2cf5 D "D", already in destination as 1:112478962961 B "B"
1327 rebasing 4:66f1a38021c9 F tip "F"
1328 $ hg log -G
1329 o 5:50e9d60b99c6 F
1330 |\
1331 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:50e9d60b99c6)
1332 | |/|
1333 | o | 3:7fb047a69f22 E
1334 | | |
1335 | | x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1336 | |/
1337 o | 1:112478962961 B
1338 |/
1339 o 0:426bada5c675 A
1340
1341 $ cd ..
1342
1343 Rebase merge where successor of other parent is equal to destination
1344
1345 $ hg init p2-succ-is-dest
1346 $ cd p2-succ-is-dest
1347
1348 $ hg debugdrawdag <<EOF
1349 > F
1350 > /|
1351 > E D B # replace: E -> B
1352 > \|/
1353 > A
1354 > EOF
1355 1 new orphan changesets
1356
1357 $ hg rebase -d B -s E
1358 note: not rebasing 3:7fb047a69f22 E "E", already in destination as 1:112478962961 B "B"
1359 rebasing 4:66f1a38021c9 F tip "F"
1360 $ hg log -G
1361 o 5:aae1787dacee F
1362 |\
1363 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:aae1787dacee)
1364 | |/|
1365 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1366 | | |
1367 | o | 2:b18e25de2cf5 D
1368 | |/
1369 o / 1:112478962961 B
1370 |/
1371 o 0:426bada5c675 A
1372
1373 $ cd ..
1374
1375 Rebase merge where successor of one parent is ancestor of destination
1376
1377 $ hg init p1-succ-in-dest
1378 $ cd p1-succ-in-dest
1379
1380 $ hg debugdrawdag <<EOF
1381 > F C
1382 > /| |
1383 > E D B # replace: D -> B
1384 > \|/
1385 > A
1386 > EOF
1387 1 new orphan changesets
1388
1389 $ hg rebase -d C -s D
1390 note: not rebasing 2:b18e25de2cf5 D "D", already in destination as 1:112478962961 B "B"
1391 rebasing 5:66f1a38021c9 F tip "F"
1392
1393 $ hg log -G
1394 o 6:0913febf6439 F
1395 |\
1396 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:0913febf6439)
1397 | | |
1398 | o | 4:26805aba1e60 C
1399 | | |
1400 o | | 3:7fb047a69f22 E
1401 | | |
1402 +---x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1403 | |
1404 | o 1:112478962961 B
1405 |/
1406 o 0:426bada5c675 A
1407
1408 $ cd ..
1409
1410 Rebase merge where successor of other parent is ancestor of destination
1411
1412 $ hg init p2-succ-in-dest
1413 $ cd p2-succ-in-dest
1414
1415 $ hg debugdrawdag <<EOF
1416 > F C
1417 > /| |
1418 > E D B # replace: E -> B
1419 > \|/
1420 > A
1421 > EOF
1422 1 new orphan changesets
1423
1424 $ hg rebase -d C -s E
1425 note: not rebasing 3:7fb047a69f22 E "E", already in destination as 1:112478962961 B "B"
1426 rebasing 5:66f1a38021c9 F tip "F"
1427 $ hg log -G
1428 o 6:c6ab0cc6d220 F
1429 |\
1430 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:c6ab0cc6d220)
1431 | | |
1432 | o | 4:26805aba1e60 C
1433 | | |
1434 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1435 | | |
1436 o---+ 2:b18e25de2cf5 D
1437 / /
1438 o / 1:112478962961 B
1439 |/
1440 o 0:426bada5c675 A
1441
1442 $ cd ..
1443
1444 Rebase merge where successor of one parent is ancestor of destination
1445
1446 $ hg init p1-succ-in-dest-b
1447 $ cd p1-succ-in-dest-b
1448
1449 $ hg debugdrawdag <<EOF
1450 > F C
1451 > /| |
1452 > E D B # replace: E -> B
1453 > \|/
1454 > A
1455 > EOF
1456 1 new orphan changesets
1457
1458 $ hg rebase -d C -b F
1459 rebasing 2:b18e25de2cf5 D "D"
1460 note: not rebasing 3:7fb047a69f22 E "E", already in destination as 1:112478962961 B "B"
1461 rebasing 5:66f1a38021c9 F tip "F"
1462 note: not rebasing 5:66f1a38021c9 F tip "F", its destination already has all its changes
1463 $ hg log -G
1464 o 6:8f47515dda15 D
1465 |
1466 | x 5:66f1a38021c9 F (pruned using rebase)
1467 | |\
1468 o | | 4:26805aba1e60 C
1469 | | |
1470 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1471 | | |
1472 | x | 2:b18e25de2cf5 D (rewritten using rebase as 6:8f47515dda15)
1473 | |/
1474 o / 1:112478962961 B
1475 |/
1476 o 0:426bada5c675 A
1477
1478 $ cd ..
1479
1480 Rebase merge where successor of other parent is ancestor of destination
1481
1482 $ hg init p2-succ-in-dest-b
1483 $ cd p2-succ-in-dest-b
1484
1485 $ hg debugdrawdag <<EOF
1486 > F C
1487 > /| |
1488 > E D B # replace: D -> B
1489 > \|/
1490 > A
1491 > EOF
1492 1 new orphan changesets
1493
1494 $ hg rebase -d C -b F
1495 note: not rebasing 2:b18e25de2cf5 D "D", already in destination as 1:112478962961 B "B"
1496 rebasing 3:7fb047a69f22 E "E"
1497 rebasing 5:66f1a38021c9 F tip "F"
1498 note: not rebasing 5:66f1a38021c9 F tip "F", its destination already has all its changes
1499
1500 $ hg log -G
1501 o 6:533690786a86 E
1502 |
1503 | x 5:66f1a38021c9 F (pruned using rebase)
1504 | |\
1505 o | | 4:26805aba1e60 C
1506 | | |
1507 | | x 3:7fb047a69f22 E (rewritten using rebase as 6:533690786a86)
1508 | | |
1509 | x | 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1510 | |/
1511 o / 1:112478962961 B
1512 |/
1513 o 0:426bada5c675 A
1514
1515 $ cd ..
1516
1517 Rebase merge where extinct node has successor that is not an ancestor of
1518 destination
1519
1520 $ hg init extinct-with-succ-not-in-dest
1521 $ cd extinct-with-succ-not-in-dest
1522
1523 $ hg debugdrawdag <<EOF
1524 > E C # replace: C -> E
1525 > | |
1526 > D B
1527 > |/
1528 > A
1529 > EOF
1530
1531 $ hg rebase -d D -s B
1532 rebasing 1:112478962961 B "B"
1533 note: not rebasing 3:26805aba1e60 C "C" and its descendants as this would cause divergence
1534
1535 $ cd ..
1536
1537 $ hg init p2-succ-in-dest-c
1538 $ cd p2-succ-in-dest-c
1539
1540 The scenario here was that B::D were developed on default. B was queued on
1541 stable, but amended before being push to hg-committed. C was queued on default,
1542 along with unrelated J.
1543
1544 $ hg debugdrawdag <<EOF
1545 > J
1546 > |
1547 > F
1548 > |
1549 > E
1550 > | D
1551 > | |
1552 > | C # replace: C -> F
1553 > | | H I # replace: B -> H -> I
1554 > | B |/
1555 > |/ G
1556 > A
1557 > EOF
1558 1 new orphan changesets
1559
1560 This strip seems to be the key to avoid an early divergence warning.
1561 $ hg --config extensions.strip= --hidden strip -qr H
1562 1 new orphan changesets
1563
1564 $ hg rebase -b 'desc("D")' -d 'desc("J")'
1565 abort: this rebase will cause divergences from: 112478962961
1566 (to force the rebase please set experimental.evolution.allowdivergence=True)
1567 [20]
1568
1569 Rebase merge where both parents have successors in destination
1570
1571 $ hg init p12-succ-in-dest
1572 $ cd p12-succ-in-dest
1573 $ hg debugdrawdag <<'EOS'
1574 > E F
1575 > /| /| # replace: A -> C
1576 > A B C D # replace: B -> D
1577 > | |
1578 > X Y
1579 > EOS
1580 1 new orphan changesets
1581 $ hg rebase -r A+B+E -d F
1582 note: not rebasing 4:a3d17304151f A "A", already in destination as 0:96cc3511f894 C "C"
1583 note: not rebasing 5:b23a2cc00842 B "B", already in destination as 1:058c1e1fb10a D "D"
1584 rebasing 7:dac5d11c5a7d E tip "E"
1585 abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f
1586 [10]
1587 $ cd ..
1588
1589 Rebase a non-clean merge. One parent has successor in destination, the other
1590 parent moves as requested.
1591
1592 $ hg init p1-succ-p2-move
1593 $ cd p1-succ-p2-move
1594 $ hg debugdrawdag <<'EOS'
1595 > D Z
1596 > /| | # replace: A -> C
1597 > A B C # D/D = D
1598 > EOS
1599 1 new orphan changesets
1600 $ hg rebase -r A+B+D -d Z
1601 note: not rebasing 0:426bada5c675 A "A", already in destination as 2:96cc3511f894 C "C"
1602 rebasing 1:fc2b737bb2e5 B "B"
1603 rebasing 3:b8ed089c80ad D "D"
1604
1605 $ rm .hg/localtags
1606 $ hg log -G
1607 o 6:e4f78693cc88 D
1608 |
1609 o 5:76840d832e98 B
1610 |
1611 o 4:50e41c1f3950 Z
1612 |
1613 o 2:96cc3511f894 C
1614
1615 $ hg files -r tip
1616 B
1617 C
1618 D
1619 Z
1620
1621 $ cd ..
1622
1623 $ hg init p1-move-p2-succ
1624 $ cd p1-move-p2-succ
1625 $ hg debugdrawdag <<'EOS'
1626 > D Z
1627 > /| | # replace: B -> C
1628 > A B C # D/D = D
1629 > EOS
1630 1 new orphan changesets
1631 $ hg rebase -r B+A+D -d Z
1632 rebasing 0:426bada5c675 A "A"
1633 note: not rebasing 1:fc2b737bb2e5 B "B", already in destination as 2:96cc3511f894 C "C"
1634 rebasing 3:b8ed089c80ad D "D"
1635
1636 $ rm .hg/localtags
1637 $ hg log -G
1638 o 6:1b355ed94d82 D
1639 |
1640 o 5:a81a74d764a6 A
1641 |
1642 o 4:50e41c1f3950 Z
1643 |
1644 o 2:96cc3511f894 C
1645
1646 $ hg files -r tip
1647 A
1648 C
1649 D
1650 Z
1651
1652 $ cd ..
1653
1654 Test that bookmark is moved and working dir is updated when all changesets have
21 Test that bookmark is moved and working dir is updated when all changesets have
1655 equivalents in destination
22 equivalents in destination
1656 $ hg init rbsrepo && cd rbsrepo
23 $ hg init rbsrepo && cd rbsrepo
General Comments 0
You need to be logged in to leave comments. Login now