tests/test-graft.t
changeset 44041 fa808e65eabb
parent 44040 58db8f63f4e2
child 44044 f3ad014b6a53
equal deleted inserted replaced
44040:58db8f63f4e2 44041:fa808e65eabb
   920   |/
   920   |/
   921   | o  1
   921   | o  1
   922   |/
   922   |/
   923   o  0
   923   o  0
   924   
   924   
   925 Graft from behind a move or rename
       
   926 ==================================
       
   927 
       
   928 NOTE: This is affected by issue5343, and will need updating when it's fixed
       
   929 
       
   930 Consider this topology for a regular graft:
       
   931 
       
   932 o c1
       
   933 |
       
   934 | o c2
       
   935 | |
       
   936 | o ca # stands for "common ancestor"
       
   937 |/
       
   938 o cta # stands for "common topological ancestor"
       
   939 
       
   940 Note that in issue5343, ca==cta.
       
   941 
       
   942 The following table shows the possible cases. Here, "x->y" and, equivalently,
       
   943 "y<-x", where x is an ancestor of y, means that some copy happened from x to y.
       
   944 
       
   945 name | c1<-cta | cta<->ca | ca->c2
       
   946 A.0  |         |          |
       
   947 A.1  |    X    |          |
       
   948 A.2  |         |     X    |
       
   949 A.3  |         |          |   X
       
   950 A.4  |    X    |     X    |
       
   951 A.5  |    X    |          |   X
       
   952 A.6  |         |     X    |   X
       
   953 A.7  |    X    |     X    |   X
       
   954 
       
   955 A.0 is trivial, and doesn't need copy tracking.
       
   956 For A.1, a forward rename is recorded in the c1 pass, to be followed later.
       
   957 In A.2, the rename is recorded in the c2 pass and followed backwards.
       
   958 A.3 is recorded in the c2 pass as a forward rename to be duplicated on target.
       
   959 In A.4, both passes of checkcopies record incomplete renames, which are
       
   960 then joined in mergecopies to record a rename to be followed.
       
   961 In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass
       
   962 records an incomplete divergence. The incomplete rename is then joined to the
       
   963 appropriate side of the incomplete divergence, and the result is recorded as a
       
   964 divergence. The code doesn't distinguish at all between these two cases, since
       
   965 the end result of them is the same: an incomplete divergence joined with an
       
   966 incomplete rename into a divergence.
       
   967 Finally, A.6 records a divergence entirely in the c2 pass.
       
   968 
       
   969 A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all.
       
   970 A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge.
       
   971 A.5 has issue5343 as a special case.
       
   972 A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious
       
   973 incomplete divergence, which is in fact complete. This is handled later in
       
   974 mergecopies.
       
   975 A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b,
       
   976 a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting,
       
   977 the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base
       
   978 case, a<-b<-c->a is treated the same as a<-b<-b->a).
       
   979 
       
   980 f5a therefore tests the "ping-pong" rename case, where a file is renamed to the
       
   981 same name on both branches, then the rename is backed out on one branch, and
       
   982 the backout is grafted to the other branch. This creates a challenging rename
       
   983 sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft
       
   984 source, respectively. Since rename detection will run on the c1 side for such a
       
   985 sequence (as for technical reasons, we split the c1 and c2 sides not at the
       
   986 graft CA, but rather at the topological CA), it will pick up a false rename,
       
   987 and cause a spurious merge conflict. This false rename is always exactly the
       
   988 reverse of the true rename that would be detected on the c2 side, so we can
       
   989 correct for it by detecting this condition and reversing as necessary.
       
   990 
       
   991 First, set up the repository with commits to be grafted
       
   992 
       
   993   $ hg init ../graftmove
       
   994   $ cd ../graftmove
       
   995   $ echo c1a > f1a
       
   996   $ echo c2a > f2a
       
   997   $ echo c3a > f3a
       
   998   $ echo c4a > f4a
       
   999   $ echo c5a > f5a
       
  1000   $ hg ci -qAm A0
       
  1001   $ hg mv f1a f1b
       
  1002   $ hg mv f3a f3b
       
  1003   $ hg mv f5a f5b
       
  1004   $ hg ci -qAm B0
       
  1005   $ echo c1c > f1b
       
  1006   $ hg mv f2a f2c
       
  1007   $ hg mv f5b f5a
       
  1008   $ echo c5c > f5a
       
  1009   $ hg ci -qAm C0
       
  1010   $ hg mv f3b f3d
       
  1011   $ echo c4d > f4a
       
  1012   $ hg ci -qAm D0
       
  1013   $ hg log -G
       
  1014   @  changeset:   3:b69f5839d2d9
       
  1015   |  tag:         tip
       
  1016   |  user:        test
       
  1017   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
  1018   |  summary:     D0
       
  1019   |
       
  1020   o  changeset:   2:f58c7e2b28fa
       
  1021   |  user:        test
       
  1022   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
  1023   |  summary:     C0
       
  1024   |
       
  1025   o  changeset:   1:3d7bba921b5d
       
  1026   |  user:        test
       
  1027   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
  1028   |  summary:     B0
       
  1029   |
       
  1030   o  changeset:   0:11f7a1b56675
       
  1031      user:        test
       
  1032      date:        Thu Jan 01 00:00:00 1970 +0000
       
  1033      summary:     A0
       
  1034   
       
  1035 
       
  1036 Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the
       
  1037 two renames actually converge to the same name (thus no actual divergence).
       
  1038 
       
  1039   $ hg up -q 'desc("A0")'
       
  1040   $ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit
       
  1041   grafting 2:f58c7e2b28fa "C0"
       
  1042   merging f1a and f1b to f1a
       
  1043   merging f5a
       
  1044   warning: can't find ancestor for 'f5a' copied from 'f5b'!
       
  1045   $ hg status --change .
       
  1046   M f1a
       
  1047   M f5a
       
  1048   A f2c
       
  1049   R f2a
       
  1050   $ hg cat f1a
       
  1051   c1c
       
  1052   $ hg cat f1b
       
  1053   f1b: no such file in rev c9763722f9bd
       
  1054   [1]
       
  1055 
       
  1056 Test the cases A.0 (f4x) and A.6 (f3x)
       
  1057 
       
  1058   $ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit
       
  1059   grafting 3:b69f5839d2d9 "D0"
       
  1060   note: possible conflict - f3b was renamed multiple times to:
       
  1061    f3a
       
  1062    f3d
       
  1063   warning: can't find ancestor for 'f3d' copied from 'f3b'!
       
  1064 
       
  1065 Set up the repository for some further tests
       
  1066 
       
  1067   $ hg up -q "min(desc("A0"))"
       
  1068   $ hg mv f1a f1e
       
  1069   $ echo c2e > f2a
       
  1070   $ hg mv f3a f3e
       
  1071   $ hg mv f4a f4e
       
  1072   $ hg mv f5a f5b
       
  1073   $ hg ci -qAm "E0"
       
  1074   $ hg up -q "min(desc("A0"))"
       
  1075   $ hg cp f1a f1f
       
  1076   $ hg ci -qAm "F0"
       
  1077   $ hg up -q "min(desc("A0"))"
       
  1078   $ hg cp f1a f1g
       
  1079   $ echo c1g > f1g
       
  1080   $ hg ci -qAm "G0"
       
  1081   $ hg log -G
       
  1082   @  changeset:   8:ba67f08fb15a
       
  1083   |  tag:         tip
       
  1084   |  parent:      0:11f7a1b56675
       
  1085   |  user:        test
       
  1086   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
  1087   |  summary:     G0
       
  1088   |
       
  1089   | o  changeset:   7:d376ab0d7fda
       
  1090   |/   parent:      0:11f7a1b56675
       
  1091   |    user:        test
       
  1092   |    date:        Thu Jan 01 00:00:00 1970 +0000
       
  1093   |    summary:     F0
       
  1094   |
       
  1095   | o  changeset:   6:6bd1736cab86
       
  1096   |/   parent:      0:11f7a1b56675
       
  1097   |    user:        test
       
  1098   |    date:        Thu Jan 01 00:00:00 1970 +0000
       
  1099   |    summary:     E0
       
  1100   |
       
  1101   | o  changeset:   5:560daee679da
       
  1102   | |  user:        test
       
  1103   | |  date:        Thu Jan 01 00:00:00 1970 +0000
       
  1104   | |  summary:     D1
       
  1105   | |
       
  1106   | o  changeset:   4:c9763722f9bd
       
  1107   |/   parent:      0:11f7a1b56675
       
  1108   |    user:        test
       
  1109   |    date:        Thu Jan 01 00:00:00 1970 +0000
       
  1110   |    summary:     C1
       
  1111   |
       
  1112   | o  changeset:   3:b69f5839d2d9
       
  1113   | |  user:        test
       
  1114   | |  date:        Thu Jan 01 00:00:00 1970 +0000
       
  1115   | |  summary:     D0
       
  1116   | |
       
  1117   | o  changeset:   2:f58c7e2b28fa
       
  1118   | |  user:        test
       
  1119   | |  date:        Thu Jan 01 00:00:00 1970 +0000
       
  1120   | |  summary:     C0
       
  1121   | |
       
  1122   | o  changeset:   1:3d7bba921b5d
       
  1123   |/   user:        test
       
  1124   |    date:        Thu Jan 01 00:00:00 1970 +0000
       
  1125   |    summary:     B0
       
  1126   |
       
  1127   o  changeset:   0:11f7a1b56675
       
  1128      user:        test
       
  1129      date:        Thu Jan 01 00:00:00 1970 +0000
       
  1130      summary:     A0
       
  1131   
       
  1132 
       
  1133 Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x),
       
  1134 and A.3 with a local content change to be preserved (f2x).
       
  1135 
       
  1136   $ hg up -q "desc("E0")"
       
  1137   $ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit
       
  1138   grafting 2:f58c7e2b28fa "C0"
       
  1139   merging f1e and f1b to f1e
       
  1140   merging f2a and f2c to f2c
       
  1141 
       
  1142 Test the cases A.1 (f4x) and A.7 (f3x).
       
  1143 
       
  1144   $ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit
       
  1145   grafting 3:b69f5839d2d9 "D0"
       
  1146   note: possible conflict - f3b was renamed multiple times to:
       
  1147    f3d
       
  1148    f3e
       
  1149   merging f4e and f4a to f4e
       
  1150   warning: can't find ancestor for 'f3d' copied from 'f3b'!
       
  1151 
       
  1152   $ hg cat f2c
       
  1153   c2e
       
  1154 
       
  1155 Test the case A.5 (move case, f1x).
       
  1156 
       
  1157   $ hg up -q "desc("C0")"
       
  1158 BROKEN: Shouldn't get the warning about missing ancestor
       
  1159   $ HGEDITOR="echo E1 >" hg graft -r 'desc("E0")' --edit
       
  1160   grafting 6:6bd1736cab86 "E0"
       
  1161   note: possible conflict - f1a was renamed multiple times to:
       
  1162    f1b
       
  1163    f1e
       
  1164   note: possible conflict - f3a was renamed multiple times to:
       
  1165    f3b
       
  1166    f3e
       
  1167   merging f2c and f2a to f2c
       
  1168   merging f5a and f5b to f5b
       
  1169   warning: can't find ancestor for 'f1e' copied from 'f1a'!
       
  1170   warning: can't find ancestor for 'f3e' copied from 'f3a'!
       
  1171   $ cat f1e
       
  1172   c1a
       
  1173 
       
  1174 Test the case A.5 (copy case, f1x).
       
  1175 
       
  1176   $ hg up -q "desc("C0")"
       
  1177 BROKEN: Shouldn't get the warning about missing ancestor
       
  1178   $ HGEDITOR="echo F1 >" hg graft -r 'desc("F0")' --edit
       
  1179   grafting 7:d376ab0d7fda "F0"
       
  1180   warning: can't find ancestor for 'f1f' copied from 'f1a'!
       
  1181 BROKEN: f1f should be marked a copy from f1b
       
  1182   $ hg st --copies --change .
       
  1183   A f1f
       
  1184 BROKEN: f1f should have the new content from f1b (i.e. "c1c")
       
  1185   $ cat f1f
       
  1186   c1a
       
  1187 
       
  1188 Test the case A.5 (copy+modify case, f1x).
       
  1189 
       
  1190   $ hg up -q "desc("C0")"
       
  1191 BROKEN: We should get a merge conflict from the 3-way merge between f1b in C0
       
  1192 (content "c1c") and f1g in G0 (content "c1g") with f1a in A0 as base (content
       
  1193 "c1a")
       
  1194   $ HGEDITOR="echo G1 >" hg graft -r 'desc("G0")' --edit
       
  1195   grafting 8:ba67f08fb15a "G0"
       
  1196   warning: can't find ancestor for 'f1g' copied from 'f1a'!
       
  1197 
       
  1198 Check the results of the grafts tested
       
  1199 
       
  1200   $ hg log -CGv --patch --git
       
  1201   @  changeset:   13:ef3adf6c20a4
       
  1202   |  tag:         tip
       
  1203   |  parent:      2:f58c7e2b28fa
       
  1204   |  user:        test
       
  1205   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
  1206   |  files:       f1g
       
  1207   |  description:
       
  1208   |  G1
       
  1209   |
       
  1210   |
       
  1211   |  diff --git a/f1g b/f1g
       
  1212   |  new file mode 100644
       
  1213   |  --- /dev/null
       
  1214   |  +++ b/f1g
       
  1215   |  @@ -0,0 +1,1 @@
       
  1216   |  +c1g
       
  1217   |
       
  1218   | o  changeset:   12:b5542d755b54
       
  1219   |/   parent:      2:f58c7e2b28fa
       
  1220   |    user:        test
       
  1221   |    date:        Thu Jan 01 00:00:00 1970 +0000
       
  1222   |    files:       f1f
       
  1223   |    description:
       
  1224   |    F1
       
  1225   |
       
  1226   |
       
  1227   |    diff --git a/f1f b/f1f
       
  1228   |    new file mode 100644
       
  1229   |    --- /dev/null
       
  1230   |    +++ b/f1f
       
  1231   |    @@ -0,0 +1,1 @@
       
  1232   |    +c1a
       
  1233   |
       
  1234   | o  changeset:   11:f8a162271246
       
  1235   |/   parent:      2:f58c7e2b28fa
       
  1236   |    user:        test
       
  1237   |    date:        Thu Jan 01 00:00:00 1970 +0000
       
  1238   |    files:       f1e f2c f3e f4a f4e f5a f5b
       
  1239   |    copies:      f4e (f4a) f5b (f5a)
       
  1240   |    description:
       
  1241   |    E1
       
  1242   |
       
  1243   |
       
  1244   |    diff --git a/f1e b/f1e
       
  1245   |    new file mode 100644
       
  1246   |    --- /dev/null
       
  1247   |    +++ b/f1e
       
  1248   |    @@ -0,0 +1,1 @@
       
  1249   |    +c1a
       
  1250   |    diff --git a/f2c b/f2c
       
  1251   |    --- a/f2c
       
  1252   |    +++ b/f2c
       
  1253   |    @@ -1,1 +1,1 @@
       
  1254   |    -c2a
       
  1255   |    +c2e
       
  1256   |    diff --git a/f3e b/f3e
       
  1257   |    new file mode 100644
       
  1258   |    --- /dev/null
       
  1259   |    +++ b/f3e
       
  1260   |    @@ -0,0 +1,1 @@
       
  1261   |    +c3a
       
  1262   |    diff --git a/f4a b/f4e
       
  1263   |    rename from f4a
       
  1264   |    rename to f4e
       
  1265   |    diff --git a/f5a b/f5b
       
  1266   |    rename from f5a
       
  1267   |    rename to f5b
       
  1268   |
       
  1269   | o  changeset:   10:93ee502e8b0a
       
  1270   | |  user:        test
       
  1271   | |  date:        Thu Jan 01 00:00:00 1970 +0000
       
  1272   | |  files:       f3d f4e
       
  1273   | |  description:
       
  1274   | |  D2
       
  1275   | |
       
  1276   | |
       
  1277   | |  diff --git a/f3d b/f3d
       
  1278   | |  new file mode 100644
       
  1279   | |  --- /dev/null
       
  1280   | |  +++ b/f3d
       
  1281   | |  @@ -0,0 +1,1 @@
       
  1282   | |  +c3a
       
  1283   | |  diff --git a/f4e b/f4e
       
  1284   | |  --- a/f4e
       
  1285   | |  +++ b/f4e
       
  1286   | |  @@ -1,1 +1,1 @@
       
  1287   | |  -c4a
       
  1288   | |  +c4d
       
  1289   | |
       
  1290   | o  changeset:   9:539cf145f496
       
  1291   | |  parent:      6:6bd1736cab86
       
  1292   | |  user:        test
       
  1293   | |  date:        Thu Jan 01 00:00:00 1970 +0000
       
  1294   | |  files:       f1e f2a f2c f5a f5b
       
  1295   | |  copies:      f2c (f2a) f5a (f5b)
       
  1296   | |  description:
       
  1297   | |  C2
       
  1298   | |
       
  1299   | |
       
  1300   | |  diff --git a/f1e b/f1e
       
  1301   | |  --- a/f1e
       
  1302   | |  +++ b/f1e
       
  1303   | |  @@ -1,1 +1,1 @@
       
  1304   | |  -c1a
       
  1305   | |  +c1c
       
  1306   | |  diff --git a/f2a b/f2c
       
  1307   | |  rename from f2a
       
  1308   | |  rename to f2c
       
  1309   | |  diff --git a/f5b b/f5a
       
  1310   | |  rename from f5b
       
  1311   | |  rename to f5a
       
  1312   | |  --- a/f5b
       
  1313   | |  +++ b/f5a
       
  1314   | |  @@ -1,1 +1,1 @@
       
  1315   | |  -c5a
       
  1316   | |  +c5c
       
  1317   | |
       
  1318   | | o  changeset:   8:ba67f08fb15a
       
  1319   | | |  parent:      0:11f7a1b56675
       
  1320   | | |  user:        test
       
  1321   | | |  date:        Thu Jan 01 00:00:00 1970 +0000
       
  1322   | | |  files:       f1g
       
  1323   | | |  copies:      f1g (f1a)
       
  1324   | | |  description:
       
  1325   | | |  G0
       
  1326   | | |
       
  1327   | | |
       
  1328   | | |  diff --git a/f1a b/f1g
       
  1329   | | |  copy from f1a
       
  1330   | | |  copy to f1g
       
  1331   | | |  --- a/f1a
       
  1332   | | |  +++ b/f1g
       
  1333   | | |  @@ -1,1 +1,1 @@
       
  1334   | | |  -c1a
       
  1335   | | |  +c1g
       
  1336   | | |
       
  1337   | | | o  changeset:   7:d376ab0d7fda
       
  1338   | | |/   parent:      0:11f7a1b56675
       
  1339   | | |    user:        test
       
  1340   | | |    date:        Thu Jan 01 00:00:00 1970 +0000
       
  1341   | | |    files:       f1f
       
  1342   | | |    copies:      f1f (f1a)
       
  1343   | | |    description:
       
  1344   | | |    F0
       
  1345   | | |
       
  1346   | | |
       
  1347   | | |    diff --git a/f1a b/f1f
       
  1348   | | |    copy from f1a
       
  1349   | | |    copy to f1f
       
  1350   | | |
       
  1351   | o |  changeset:   6:6bd1736cab86
       
  1352   | |/   parent:      0:11f7a1b56675
       
  1353   | |    user:        test
       
  1354   | |    date:        Thu Jan 01 00:00:00 1970 +0000
       
  1355   | |    files:       f1a f1e f2a f3a f3e f4a f4e f5a f5b
       
  1356   | |    copies:      f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a)
       
  1357   | |    description:
       
  1358   | |    E0
       
  1359   | |
       
  1360   | |
       
  1361   | |    diff --git a/f1a b/f1e
       
  1362   | |    rename from f1a
       
  1363   | |    rename to f1e
       
  1364   | |    diff --git a/f2a b/f2a
       
  1365   | |    --- a/f2a
       
  1366   | |    +++ b/f2a
       
  1367   | |    @@ -1,1 +1,1 @@
       
  1368   | |    -c2a
       
  1369   | |    +c2e
       
  1370   | |    diff --git a/f3a b/f3e
       
  1371   | |    rename from f3a
       
  1372   | |    rename to f3e
       
  1373   | |    diff --git a/f4a b/f4e
       
  1374   | |    rename from f4a
       
  1375   | |    rename to f4e
       
  1376   | |    diff --git a/f5a b/f5b
       
  1377   | |    rename from f5a
       
  1378   | |    rename to f5b
       
  1379   | |
       
  1380   | | o  changeset:   5:560daee679da
       
  1381   | | |  user:        test
       
  1382   | | |  date:        Thu Jan 01 00:00:00 1970 +0000
       
  1383   | | |  files:       f3d f4a
       
  1384   | | |  description:
       
  1385   | | |  D1
       
  1386   | | |
       
  1387   | | |
       
  1388   | | |  diff --git a/f3d b/f3d
       
  1389   | | |  new file mode 100644
       
  1390   | | |  --- /dev/null
       
  1391   | | |  +++ b/f3d
       
  1392   | | |  @@ -0,0 +1,1 @@
       
  1393   | | |  +c3a
       
  1394   | | |  diff --git a/f4a b/f4a
       
  1395   | | |  --- a/f4a
       
  1396   | | |  +++ b/f4a
       
  1397   | | |  @@ -1,1 +1,1 @@
       
  1398   | | |  -c4a
       
  1399   | | |  +c4d
       
  1400   | | |
       
  1401   | | o  changeset:   4:c9763722f9bd
       
  1402   | |/   parent:      0:11f7a1b56675
       
  1403   | |    user:        test
       
  1404   | |    date:        Thu Jan 01 00:00:00 1970 +0000
       
  1405   | |    files:       f1a f2a f2c f5a
       
  1406   | |    copies:      f2c (f2a)
       
  1407   | |    description:
       
  1408   | |    C1
       
  1409   | |
       
  1410   | |
       
  1411   | |    diff --git a/f1a b/f1a
       
  1412   | |    --- a/f1a
       
  1413   | |    +++ b/f1a
       
  1414   | |    @@ -1,1 +1,1 @@
       
  1415   | |    -c1a
       
  1416   | |    +c1c
       
  1417   | |    diff --git a/f2a b/f2c
       
  1418   | |    rename from f2a
       
  1419   | |    rename to f2c
       
  1420   | |    diff --git a/f5a b/f5a
       
  1421   | |    --- a/f5a
       
  1422   | |    +++ b/f5a
       
  1423   | |    @@ -1,1 +1,1 @@
       
  1424   | |    -c5a
       
  1425   | |    +c5c
       
  1426   | |
       
  1427   +---o  changeset:   3:b69f5839d2d9
       
  1428   | |    user:        test
       
  1429   | |    date:        Thu Jan 01 00:00:00 1970 +0000
       
  1430   | |    files:       f3b f3d f4a
       
  1431   | |    copies:      f3d (f3b)
       
  1432   | |    description:
       
  1433   | |    D0
       
  1434   | |
       
  1435   | |
       
  1436   | |    diff --git a/f3b b/f3d
       
  1437   | |    rename from f3b
       
  1438   | |    rename to f3d
       
  1439   | |    diff --git a/f4a b/f4a
       
  1440   | |    --- a/f4a
       
  1441   | |    +++ b/f4a
       
  1442   | |    @@ -1,1 +1,1 @@
       
  1443   | |    -c4a
       
  1444   | |    +c4d
       
  1445   | |
       
  1446   o |  changeset:   2:f58c7e2b28fa
       
  1447   | |  user:        test
       
  1448   | |  date:        Thu Jan 01 00:00:00 1970 +0000
       
  1449   | |  files:       f1b f2a f2c f5a f5b
       
  1450   | |  copies:      f2c (f2a) f5a (f5b)
       
  1451   | |  description:
       
  1452   | |  C0
       
  1453   | |
       
  1454   | |
       
  1455   | |  diff --git a/f1b b/f1b
       
  1456   | |  --- a/f1b
       
  1457   | |  +++ b/f1b
       
  1458   | |  @@ -1,1 +1,1 @@
       
  1459   | |  -c1a
       
  1460   | |  +c1c
       
  1461   | |  diff --git a/f2a b/f2c
       
  1462   | |  rename from f2a
       
  1463   | |  rename to f2c
       
  1464   | |  diff --git a/f5b b/f5a
       
  1465   | |  rename from f5b
       
  1466   | |  rename to f5a
       
  1467   | |  --- a/f5b
       
  1468   | |  +++ b/f5a
       
  1469   | |  @@ -1,1 +1,1 @@
       
  1470   | |  -c5a
       
  1471   | |  +c5c
       
  1472   | |
       
  1473   o |  changeset:   1:3d7bba921b5d
       
  1474   |/   user:        test
       
  1475   |    date:        Thu Jan 01 00:00:00 1970 +0000
       
  1476   |    files:       f1a f1b f3a f3b f5a f5b
       
  1477   |    copies:      f1b (f1a) f3b (f3a) f5b (f5a)
       
  1478   |    description:
       
  1479   |    B0
       
  1480   |
       
  1481   |
       
  1482   |    diff --git a/f1a b/f1b
       
  1483   |    rename from f1a
       
  1484   |    rename to f1b
       
  1485   |    diff --git a/f3a b/f3b
       
  1486   |    rename from f3a
       
  1487   |    rename to f3b
       
  1488   |    diff --git a/f5a b/f5b
       
  1489   |    rename from f5a
       
  1490   |    rename to f5b
       
  1491   |
       
  1492   o  changeset:   0:11f7a1b56675
       
  1493      user:        test
       
  1494      date:        Thu Jan 01 00:00:00 1970 +0000
       
  1495      files:       f1a f2a f3a f4a f5a
       
  1496      description:
       
  1497      A0
       
  1498   
       
  1499   
       
  1500      diff --git a/f1a b/f1a
       
  1501      new file mode 100644
       
  1502      --- /dev/null
       
  1503      +++ b/f1a
       
  1504      @@ -0,0 +1,1 @@
       
  1505      +c1a
       
  1506      diff --git a/f2a b/f2a
       
  1507      new file mode 100644
       
  1508      --- /dev/null
       
  1509      +++ b/f2a
       
  1510      @@ -0,0 +1,1 @@
       
  1511      +c2a
       
  1512      diff --git a/f3a b/f3a
       
  1513      new file mode 100644
       
  1514      --- /dev/null
       
  1515      +++ b/f3a
       
  1516      @@ -0,0 +1,1 @@
       
  1517      +c3a
       
  1518      diff --git a/f4a b/f4a
       
  1519      new file mode 100644
       
  1520      --- /dev/null
       
  1521      +++ b/f4a
       
  1522      @@ -0,0 +1,1 @@
       
  1523      +c4a
       
  1524      diff --git a/f5a b/f5a
       
  1525      new file mode 100644
       
  1526      --- /dev/null
       
  1527      +++ b/f5a
       
  1528      @@ -0,0 +1,1 @@
       
  1529      +c5a
       
  1530   
       
  1531 Check superfluous filemerge of files renamed in the past but untouched by graft
       
  1532 
       
  1533   $ echo a > a
       
  1534   $ hg ci -qAma
       
  1535   $ hg mv a b
       
  1536   $ echo b > b
       
  1537   $ hg ci -qAmb
       
  1538   $ echo c > c
       
  1539   $ hg ci -qAmc
       
  1540   $ hg up -q .~2
       
  1541   $ hg graft tip -qt:fail
       
  1542 
       
  1543   $ cd ..
       
  1544 
       
  1545 Graft a change into a new file previously grafted into a renamed directory
       
  1546 
       
  1547   $ hg init dirmovenewfile
       
  1548   $ cd dirmovenewfile
       
  1549   $ mkdir a
       
  1550   $ echo a > a/a
       
  1551   $ hg ci -qAma
       
  1552   $ echo x > a/x
       
  1553   $ hg ci -qAmx
       
  1554   $ hg up -q 0
       
  1555   $ hg mv -q a b
       
  1556   $ hg ci -qAmb
       
  1557   $ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded
       
  1558   $ hg up -q 1
       
  1559   $ echo y > a/x
       
  1560   $ hg ci -qAmy
       
  1561   $ hg up -q 3
       
  1562   $ hg graft -q 4
       
  1563   $ hg status --change .
       
  1564   M b/x
       
  1565 
       
  1566 Prepare for test of skipped changesets and how merges can influence it:
       
  1567 
       
  1568   $ hg merge -q -r 1 --tool :local
       
  1569   $ hg ci -m m
       
  1570   $ echo xx >> b/x
       
  1571   $ hg ci -m xx
       
  1572 
       
  1573   $ hg log -G -T '{rev} {desc|firstline}'
       
  1574   @  7 xx
       
  1575   |
       
  1576   o    6 m
       
  1577   |\
       
  1578   | o  5 y
       
  1579   | |
       
  1580   +---o  4 y
       
  1581   | |
       
  1582   | o  3 x
       
  1583   | |
       
  1584   | o  2 b
       
  1585   | |
       
  1586   o |  1 x
       
  1587   |/
       
  1588   o  0 a
       
  1589   
       
  1590 Grafting of plain changes correctly detects that 3 and 5 should be skipped:
       
  1591 
       
  1592   $ hg up -qCr 4
       
  1593   $ hg graft --tool :local -r 2::5
       
  1594   skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
       
  1595   skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
       
  1596   grafting 2:42127f193bcd "b"
       
  1597 
       
  1598 Extending the graft range to include a (skipped) merge of 3 will not prevent us from
       
  1599 also detecting that both 3 and 5 should be skipped:
       
  1600 
       
  1601   $ hg up -qCr 4
       
  1602   $ hg graft --tool :local -r 2::7
       
  1603   skipping ungraftable merge revision 6
       
  1604   skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
       
  1605   skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
       
  1606   grafting 2:42127f193bcd "b"
       
  1607   grafting 7:d3c3f2b38ecc "xx"
       
  1608   note: graft of 7:d3c3f2b38ecc created no changes to commit
       
  1609 
       
  1610   $ cd ..
       
  1611 
       
  1612 Grafted revision should be warned and skipped only once. (issue6024)
       
  1613 
       
  1614   $ mkdir issue6024
       
  1615   $ cd issue6024
       
  1616 
       
  1617   $ hg init base
       
  1618   $ cd base
       
  1619   $ touch x
       
  1620   $ hg commit -qAminit
       
  1621   $ echo a > x
       
  1622   $ hg commit -mchange
       
  1623   $ hg update -q 0
       
  1624   $ hg graft -r 1
       
  1625   grafting 1:a0b923c546aa "change" (tip)
       
  1626   $ cd ..
       
  1627 
       
  1628   $ hg clone -qr 2 base clone
       
  1629   $ cd clone
       
  1630   $ hg pull -q
       
  1631   $ hg merge -q 2
       
  1632   $ hg commit -mmerge
       
  1633   $ hg update -q 0
       
  1634   $ hg graft -r 1
       
  1635   grafting 1:04fc6d444368 "change"
       
  1636   $ hg update -q 3
       
  1637   $ hg log -G -T '{rev}:{node|shortest} <- {extras.source|shortest}\n'
       
  1638   o  4:4e16 <- a0b9
       
  1639   |
       
  1640   | @    3:f0ac <-
       
  1641   | |\
       
  1642   +---o  2:a0b9 <-
       
  1643   | |
       
  1644   | o  1:04fc <- a0b9
       
  1645   |/
       
  1646   o  0:7848 <-
       
  1647   
       
  1648 
       
  1649  the source of rev 4 is an ancestor of the working parent, and was also
       
  1650  grafted as rev 1. it should be stripped from the target revisions only once.
       
  1651 
       
  1652   $ hg graft -r 4
       
  1653   skipping already grafted revision 4:4e16bab40c9c (1:04fc6d444368 also has origin 2:a0b923c546aa)
       
  1654   [255]
       
  1655 
       
  1656   $ cd ../..