Show More
@@ -842,3 +842,461 b' Graft to duplicate a commit twice' | |||
|
842 | 842 | |/ |
|
843 | 843 | o 0 |
|
844 | 844 | |
|
845 | Graft from behind a move or rename | |
|
846 | ================================== | |
|
847 | ||
|
848 | NOTE: This is affected by issue5343, and will need updating when it's fixed | |
|
849 | ||
|
850 | Possible cases during a regular graft (when ca is between cta and c2): | |
|
851 | ||
|
852 | name | c1<-cta | cta<->ca | ca->c2 | |
|
853 | A.0 | | | | |
|
854 | A.1 | X | | | |
|
855 | A.2 | | X | | |
|
856 | A.3 | | | X | |
|
857 | A.4 | X | X | | |
|
858 | A.5 | X | | X | |
|
859 | A.6 | | X | X | |
|
860 | A.7 | X | X | X | |
|
861 | ||
|
862 | A.0 is trivial, and doesn't need copy tracking. | |
|
863 | For A.1, a forward rename is recorded in the c1 pass, to be followed later. | |
|
864 | In A.2, the rename is recorded in the c2 pass and followed backwards. | |
|
865 | A.3 is recorded in the c2 pass as a forward rename to be duplicated on target. | |
|
866 | In A.4, both passes of checkcopies record incomplete renames, which are | |
|
867 | then joined in mergecopies to record a rename to be followed. | |
|
868 | In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass | |
|
869 | records an incomplete divergence. The incomplete rename is then joined to the | |
|
870 | appropriate side of the incomplete divergence, and the result is recorded as a | |
|
871 | divergence. The code doesn't distinguish at all between these two cases, since | |
|
872 | the end result of them is the same: an incomplete divergence joined with an | |
|
873 | incomplete rename into a divergence. | |
|
874 | Finally, A.6 records a divergence entirely in the c2 pass. | |
|
875 | ||
|
876 | A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all. | |
|
877 | A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge. | |
|
878 | A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious | |
|
879 | incomplete divergence, which is in fact complete. This is handled later in | |
|
880 | mergecopies. | |
|
881 | A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b, | |
|
882 | a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting, | |
|
883 | the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base | |
|
884 | case, a<-b<-c->a is treated the same as a<-b<-b->a). | |
|
885 | ||
|
886 | f5a therefore tests the "ping-pong" rename case, where a file is renamed to the | |
|
887 | same name on both branches, then the rename is backed out on one branch, and | |
|
888 | the backout is grafted to the other branch. This creates a challenging rename | |
|
889 | sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft | |
|
890 | source, respectively. Since rename detection will run on the c1 side for such a | |
|
891 | sequence (as for technical reasons, we split the c1 and c2 sides not at the | |
|
892 | graft CA, but rather at the topological CA), it will pick up a false rename, | |
|
893 | and cause a spurious merge conflict. This false rename is always exactly the | |
|
894 | reverse of the true rename that would be detected on the c2 side, so we can | |
|
895 | correct for it by detecting this condition and reversing as necessary. | |
|
896 | ||
|
897 | First, set up the repository with commits to be grafted | |
|
898 | ||
|
899 | $ hg init ../graftmove | |
|
900 | $ cd ../graftmove | |
|
901 | $ echo c1a > f1a | |
|
902 | $ echo c2a > f2a | |
|
903 | $ echo c3a > f3a | |
|
904 | $ echo c4a > f4a | |
|
905 | $ echo c5a > f5a | |
|
906 | $ hg ci -qAm A0 | |
|
907 | $ hg mv f1a f1b | |
|
908 | $ hg mv f3a f3b | |
|
909 | $ hg mv f5a f5b | |
|
910 | $ hg ci -qAm B0 | |
|
911 | $ echo c1c > f1b | |
|
912 | $ hg mv f2a f2c | |
|
913 | $ hg mv f5b f5a | |
|
914 | $ echo c5c > f5a | |
|
915 | $ hg ci -qAm C0 | |
|
916 | $ hg mv f3b f3d | |
|
917 | $ echo c4d > f4a | |
|
918 | $ hg ci -qAm D0 | |
|
919 | $ hg log -G | |
|
920 | @ changeset: 3:b69f5839d2d9 | |
|
921 | | tag: tip | |
|
922 | | user: test | |
|
923 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
924 | | summary: D0 | |
|
925 | | | |
|
926 | o changeset: 2:f58c7e2b28fa | |
|
927 | | user: test | |
|
928 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
929 | | summary: C0 | |
|
930 | | | |
|
931 | o changeset: 1:3d7bba921b5d | |
|
932 | | user: test | |
|
933 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
934 | | summary: B0 | |
|
935 | | | |
|
936 | o changeset: 0:11f7a1b56675 | |
|
937 | user: test | |
|
938 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
939 | summary: A0 | |
|
940 | ||
|
941 | ||
|
942 | Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the | |
|
943 | two renames actually converge to the same name (thus no actual divergence). | |
|
944 | ||
|
945 | $ hg up -q 'desc("A0")' | |
|
946 | $ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit | |
|
947 | grafting 2:f58c7e2b28fa "C0" | |
|
948 | merging f5a | |
|
949 | warning: conflicts while merging f5a! (edit, then use 'hg resolve --mark') | |
|
950 | abort: unresolved conflicts, can't continue | |
|
951 | (use 'hg resolve' and 'hg graft --continue') | |
|
952 | [255] | |
|
953 | $ hg resolve f5a -t ':other' # XXX work around failure | |
|
954 | (no more unresolved files) | |
|
955 | continue: hg graft --continue | |
|
956 | $ hg graft --continue # XXX work around failure | |
|
957 | grafting 2:f58c7e2b28fa "C0" | |
|
958 | warning: can't find ancestor for 'f5a' copied from 'f5b'! | |
|
959 | $ hg status --change . | |
|
960 | M f5a | |
|
961 | A f1b | |
|
962 | A f2c | |
|
963 | R f2a | |
|
964 | $ hg cat f1a | |
|
965 | c1a | |
|
966 | $ hg cat f1b | |
|
967 | c1c | |
|
968 | ||
|
969 | Test the cases A.0 (f4x) and A.6 (f3x) | |
|
970 | ||
|
971 | $ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit | |
|
972 | grafting 3:b69f5839d2d9 "D0" | |
|
973 | warning: can't find ancestor for 'f3d' copied from 'f3b'! | |
|
974 | ||
|
975 | Set up the repository for some further tests | |
|
976 | ||
|
977 | $ hg up -q "min(desc("A0"))" | |
|
978 | $ hg mv f1a f1e | |
|
979 | $ echo c2e > f2a | |
|
980 | $ hg mv f3a f3e | |
|
981 | $ hg mv f4a f4e | |
|
982 | $ hg mv f5a f5b | |
|
983 | $ hg ci -qAm "E0" | |
|
984 | $ hg log -G | |
|
985 | @ changeset: 6:ebba59d1fb02 | |
|
986 | | tag: tip | |
|
987 | | parent: 0:11f7a1b56675 | |
|
988 | | user: test | |
|
989 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
990 | | summary: E0 | |
|
991 | | | |
|
992 | | o changeset: 5:573bb6b4b56d | |
|
993 | | | user: test | |
|
994 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
995 | | | summary: D1 | |
|
996 | | | | |
|
997 | | o changeset: 4:af23416e619b | |
|
998 | |/ parent: 0:11f7a1b56675 | |
|
999 | | user: test | |
|
1000 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1001 | | summary: C0 | |
|
1002 | | | |
|
1003 | | o changeset: 3:b69f5839d2d9 | |
|
1004 | | | user: test | |
|
1005 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1006 | | | summary: D0 | |
|
1007 | | | | |
|
1008 | | o changeset: 2:f58c7e2b28fa | |
|
1009 | | | user: test | |
|
1010 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1011 | | | summary: C0 | |
|
1012 | | | | |
|
1013 | | o changeset: 1:3d7bba921b5d | |
|
1014 | |/ user: test | |
|
1015 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1016 | | summary: B0 | |
|
1017 | | | |
|
1018 | o changeset: 0:11f7a1b56675 | |
|
1019 | user: test | |
|
1020 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1021 | summary: A0 | |
|
1022 | ||
|
1023 | ||
|
1024 | Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x), | |
|
1025 | and A.3 with a local content change to be preserved (f2x). | |
|
1026 | ||
|
1027 | $ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit | |
|
1028 | grafting 2:f58c7e2b28fa "C0" | |
|
1029 | other [graft] changed f1b which local [local] deleted | |
|
1030 | use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u | |
|
1031 | merging f2a and f2c to f2c | |
|
1032 | abort: unresolved conflicts, can't continue | |
|
1033 | (use 'hg resolve' and 'hg graft --continue') | |
|
1034 | [255] | |
|
1035 | $ hg resolve f1b -t ':other' # XXX work around failure | |
|
1036 | (no more unresolved files) | |
|
1037 | continue: hg graft --continue | |
|
1038 | $ hg graft --continue # XXX work around failure | |
|
1039 | grafting 2:f58c7e2b28fa "C0" | |
|
1040 | grafting 4:af23416e619b "C0" | |
|
1041 | merging f2c | |
|
1042 | warning: can't find ancestor for 'f2c' copied from 'f2a'! | |
|
1043 | ||
|
1044 | Test the cases A.1 (f4x) and A.7 (f3x). | |
|
1045 | ||
|
1046 | $ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit | |
|
1047 | grafting 3:b69f5839d2d9 "D0" | |
|
1048 | merging f4e and f4a to f4e | |
|
1049 | warning: can't find ancestor for 'f3d' copied from 'f3b'! | |
|
1050 | ||
|
1051 | Check the results of the grafts tested | |
|
1052 | ||
|
1053 | $ hg log -CGv --patch --git | |
|
1054 | @ changeset: 9:6d76b84e6e84 | |
|
1055 | | tag: tip | |
|
1056 | | user: test | |
|
1057 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1058 | | files: f3d f4e | |
|
1059 | | description: | |
|
1060 | | D2 | |
|
1061 | | | |
|
1062 | | | |
|
1063 | | diff --git a/f3d b/f3d | |
|
1064 | | new file mode 100644 | |
|
1065 | | --- /dev/null | |
|
1066 | | +++ b/f3d | |
|
1067 | | @@ -0,0 +1,1 @@ | |
|
1068 | | +c3a | |
|
1069 | | diff --git a/f4e b/f4e | |
|
1070 | | --- a/f4e | |
|
1071 | | +++ b/f4e | |
|
1072 | | @@ -1,1 +1,1 @@ | |
|
1073 | | -c4a | |
|
1074 | | +c4d | |
|
1075 | | | |
|
1076 | o changeset: 8:3079ba7d03f0 | |
|
1077 | | user: test | |
|
1078 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1079 | | description: | |
|
1080 | | C0 | |
|
1081 | | | |
|
1082 | | | |
|
1083 | | | |
|
1084 | o changeset: 7:dc778749ee9a | |
|
1085 | | user: test | |
|
1086 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1087 | | files: f1b f2a f2c f5a f5b | |
|
1088 | | copies: f2c (f2a) f5a (f5b) | |
|
1089 | | description: | |
|
1090 | | C0 | |
|
1091 | | | |
|
1092 | | | |
|
1093 | | diff --git a/f1b b/f1b | |
|
1094 | | new file mode 100644 | |
|
1095 | | --- /dev/null | |
|
1096 | | +++ b/f1b | |
|
1097 | | @@ -0,0 +1,1 @@ | |
|
1098 | | +c1c | |
|
1099 | | diff --git a/f2a b/f2c | |
|
1100 | | rename from f2a | |
|
1101 | | rename to f2c | |
|
1102 | | diff --git a/f5b b/f5a | |
|
1103 | | rename from f5b | |
|
1104 | | rename to f5a | |
|
1105 | | --- a/f5b | |
|
1106 | | +++ b/f5a | |
|
1107 | | @@ -1,1 +1,1 @@ | |
|
1108 | | -c5a | |
|
1109 | | +c5c | |
|
1110 | | | |
|
1111 | o changeset: 6:ebba59d1fb02 | |
|
1112 | | parent: 0:11f7a1b56675 | |
|
1113 | | user: test | |
|
1114 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1115 | | files: f1a f1e f2a f3a f3e f4a f4e f5a f5a.orig f5b | |
|
1116 | | copies: f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a) | |
|
1117 | | description: | |
|
1118 | | E0 | |
|
1119 | | | |
|
1120 | | | |
|
1121 | | diff --git a/f1a b/f1e | |
|
1122 | | rename from f1a | |
|
1123 | | rename to f1e | |
|
1124 | | diff --git a/f2a b/f2a | |
|
1125 | | --- a/f2a | |
|
1126 | | +++ b/f2a | |
|
1127 | | @@ -1,1 +1,1 @@ | |
|
1128 | | -c2a | |
|
1129 | | +c2e | |
|
1130 | | diff --git a/f3a b/f3e | |
|
1131 | | rename from f3a | |
|
1132 | | rename to f3e | |
|
1133 | | diff --git a/f4a b/f4e | |
|
1134 | | rename from f4a | |
|
1135 | | rename to f4e | |
|
1136 | | diff --git a/f5a.orig b/f5a.orig | |
|
1137 | | new file mode 100644 | |
|
1138 | | --- /dev/null | |
|
1139 | | +++ b/f5a.orig | |
|
1140 | | @@ -0,0 +1,5 @@ | |
|
1141 | | +<<<<<<< local: 11f7a1b56675 - test: A0 | |
|
1142 | | +c5a | |
|
1143 | | +======= | |
|
1144 | | +c5c | |
|
1145 | | +>>>>>>> graft: f58c7e2b28fa - test: C0 | |
|
1146 | | diff --git a/f5a b/f5b | |
|
1147 | | rename from f5a | |
|
1148 | | rename to f5b | |
|
1149 | | | |
|
1150 | | o changeset: 5:573bb6b4b56d | |
|
1151 | | | user: test | |
|
1152 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1153 | | | files: f3d f4a | |
|
1154 | | | description: | |
|
1155 | | | D1 | |
|
1156 | | | | |
|
1157 | | | | |
|
1158 | | | diff --git a/f3d b/f3d | |
|
1159 | | | new file mode 100644 | |
|
1160 | | | --- /dev/null | |
|
1161 | | | +++ b/f3d | |
|
1162 | | | @@ -0,0 +1,1 @@ | |
|
1163 | | | +c3a | |
|
1164 | | | diff --git a/f4a b/f4a | |
|
1165 | | | --- a/f4a | |
|
1166 | | | +++ b/f4a | |
|
1167 | | | @@ -1,1 +1,1 @@ | |
|
1168 | | | -c4a | |
|
1169 | | | +c4d | |
|
1170 | | | | |
|
1171 | | o changeset: 4:af23416e619b | |
|
1172 | |/ parent: 0:11f7a1b56675 | |
|
1173 | | user: test | |
|
1174 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1175 | | files: f1b f2a f2c f5a | |
|
1176 | | copies: f2c (f2a) | |
|
1177 | | description: | |
|
1178 | | C0 | |
|
1179 | | | |
|
1180 | | | |
|
1181 | | diff --git a/f1b b/f1b | |
|
1182 | | new file mode 100644 | |
|
1183 | | --- /dev/null | |
|
1184 | | +++ b/f1b | |
|
1185 | | @@ -0,0 +1,1 @@ | |
|
1186 | | +c1c | |
|
1187 | | diff --git a/f2a b/f2c | |
|
1188 | | rename from f2a | |
|
1189 | | rename to f2c | |
|
1190 | | diff --git a/f5a b/f5a | |
|
1191 | | --- a/f5a | |
|
1192 | | +++ b/f5a | |
|
1193 | | @@ -1,1 +1,1 @@ | |
|
1194 | | -c5a | |
|
1195 | | +c5c | |
|
1196 | | | |
|
1197 | | o changeset: 3:b69f5839d2d9 | |
|
1198 | | | user: test | |
|
1199 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1200 | | | files: f3b f3d f4a | |
|
1201 | | | copies: f3d (f3b) | |
|
1202 | | | description: | |
|
1203 | | | D0 | |
|
1204 | | | | |
|
1205 | | | | |
|
1206 | | | diff --git a/f3b b/f3d | |
|
1207 | | | rename from f3b | |
|
1208 | | | rename to f3d | |
|
1209 | | | diff --git a/f4a b/f4a | |
|
1210 | | | --- a/f4a | |
|
1211 | | | +++ b/f4a | |
|
1212 | | | @@ -1,1 +1,1 @@ | |
|
1213 | | | -c4a | |
|
1214 | | | +c4d | |
|
1215 | | | | |
|
1216 | | o changeset: 2:f58c7e2b28fa | |
|
1217 | | | user: test | |
|
1218 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1219 | | | files: f1b f2a f2c f5a f5b | |
|
1220 | | | copies: f2c (f2a) f5a (f5b) | |
|
1221 | | | description: | |
|
1222 | | | C0 | |
|
1223 | | | | |
|
1224 | | | | |
|
1225 | | | diff --git a/f1b b/f1b | |
|
1226 | | | --- a/f1b | |
|
1227 | | | +++ b/f1b | |
|
1228 | | | @@ -1,1 +1,1 @@ | |
|
1229 | | | -c1a | |
|
1230 | | | +c1c | |
|
1231 | | | diff --git a/f2a b/f2c | |
|
1232 | | | rename from f2a | |
|
1233 | | | rename to f2c | |
|
1234 | | | diff --git a/f5b b/f5a | |
|
1235 | | | rename from f5b | |
|
1236 | | | rename to f5a | |
|
1237 | | | --- a/f5b | |
|
1238 | | | +++ b/f5a | |
|
1239 | | | @@ -1,1 +1,1 @@ | |
|
1240 | | | -c5a | |
|
1241 | | | +c5c | |
|
1242 | | | | |
|
1243 | | o changeset: 1:3d7bba921b5d | |
|
1244 | |/ user: test | |
|
1245 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1246 | | files: f1a f1b f3a f3b f5a f5b | |
|
1247 | | copies: f1b (f1a) f3b (f3a) f5b (f5a) | |
|
1248 | | description: | |
|
1249 | | B0 | |
|
1250 | | | |
|
1251 | | | |
|
1252 | | diff --git a/f1a b/f1b | |
|
1253 | | rename from f1a | |
|
1254 | | rename to f1b | |
|
1255 | | diff --git a/f3a b/f3b | |
|
1256 | | rename from f3a | |
|
1257 | | rename to f3b | |
|
1258 | | diff --git a/f5a b/f5b | |
|
1259 | | rename from f5a | |
|
1260 | | rename to f5b | |
|
1261 | | | |
|
1262 | o changeset: 0:11f7a1b56675 | |
|
1263 | user: test | |
|
1264 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
1265 | files: f1a f2a f3a f4a f5a | |
|
1266 | description: | |
|
1267 | A0 | |
|
1268 | ||
|
1269 | ||
|
1270 | diff --git a/f1a b/f1a | |
|
1271 | new file mode 100644 | |
|
1272 | --- /dev/null | |
|
1273 | +++ b/f1a | |
|
1274 | @@ -0,0 +1,1 @@ | |
|
1275 | +c1a | |
|
1276 | diff --git a/f2a b/f2a | |
|
1277 | new file mode 100644 | |
|
1278 | --- /dev/null | |
|
1279 | +++ b/f2a | |
|
1280 | @@ -0,0 +1,1 @@ | |
|
1281 | +c2a | |
|
1282 | diff --git a/f3a b/f3a | |
|
1283 | new file mode 100644 | |
|
1284 | --- /dev/null | |
|
1285 | +++ b/f3a | |
|
1286 | @@ -0,0 +1,1 @@ | |
|
1287 | +c3a | |
|
1288 | diff --git a/f4a b/f4a | |
|
1289 | new file mode 100644 | |
|
1290 | --- /dev/null | |
|
1291 | +++ b/f4a | |
|
1292 | @@ -0,0 +1,1 @@ | |
|
1293 | +c4a | |
|
1294 | diff --git a/f5a b/f5a | |
|
1295 | new file mode 100644 | |
|
1296 | --- /dev/null | |
|
1297 | +++ b/f5a | |
|
1298 | @@ -0,0 +1,1 @@ | |
|
1299 | +c5a | |
|
1300 | ||
|
1301 | $ hg cat f2c | |
|
1302 | c2e |
General Comments 0
You need to be logged in to leave comments.
Login now