tests/test-rebase-obsolete.t
changeset 35058 a68c3420be41
parent 35057 0564e7c7f4cd
child 35393 4441705b7111
equal deleted inserted replaced
35057:0564e7c7f4cd 35058:a68c3420be41
   983   continue: hg rebase --continue
   983   continue: hg rebase --continue
   984   $ hg rebase --continue
   984   $ hg rebase --continue
   985   rebasing 19:b82fb57ea638 "willconflict second version"
   985   rebasing 19:b82fb57ea638 "willconflict second version"
   986   note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
   986   note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
   987   rebasing 21:7bdc8a87673d "dummy change" (tip)
   987   rebasing 21:7bdc8a87673d "dummy change" (tip)
       
   988   $ cd ..
       
   989 
       
   990 Divergence cases due to obsolete changesets
       
   991 -------------------------------------------
       
   992 
       
   993 We should ignore branches with unstable changesets when they are based on an
       
   994 obsolete changeset which successor is in rebase set.
       
   995 
       
   996   $ hg init divergence
       
   997   $ cd divergence
       
   998   $ cat >> .hg/hgrc << EOF
       
   999   > [extensions]
       
  1000   > strip =
       
  1001   > [alias]
       
  1002   > strip = strip --no-backup --quiet
       
  1003   > [templates]
       
  1004   > instabilities = '{rev}:{node|short} {desc|firstline}{if(instabilities," ({instabilities})")}\n'
       
  1005   > EOF
       
  1006 
       
  1007   $ hg debugdrawdag <<EOF
       
  1008   >   e   f
       
  1009   >   |   |
       
  1010   >   d'  d # replace: d -> d'
       
  1011   >    \ /
       
  1012   >     c
       
  1013   >     |
       
  1014   >   x b
       
  1015   >    \|
       
  1016   >     a
       
  1017   > EOF
       
  1018   $ hg log -G -r 'a'::
       
  1019   o  7:1143e9adc121 f
       
  1020   |
       
  1021   | o  6:d60ebfa0f1cb e
       
  1022   | |
       
  1023   | o  5:027ad6c5830d d'
       
  1024   | |
       
  1025   x |  4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
       
  1026   |/
       
  1027   o  3:a82ac2b38757 c
       
  1028   |
       
  1029   | o  2:630d7c95eff7 x
       
  1030   | |
       
  1031   o |  1:488e1b7e7341 b
       
  1032   |/
       
  1033   o  0:b173517d0057 a
       
  1034   
       
  1035 
       
  1036 Changeset d and its descendants are excluded to avoid divergence of d, which
       
  1037 would occur because the successor of d (d') is also in rebaseset. As a
       
  1038 consequence f (descendant of d) is left behind.
       
  1039 
       
  1040   $ hg rebase -b 'e' -d 'x'
       
  1041   rebasing 1:488e1b7e7341 "b" (b)
       
  1042   rebasing 3:a82ac2b38757 "c" (c)
       
  1043   rebasing 5:027ad6c5830d "d'" (d')
       
  1044   rebasing 6:d60ebfa0f1cb "e" (e)
       
  1045   note: not rebasing 4:76be324c128b "d" (d) and its descendants as this would cause divergence
       
  1046   $ hg log -G -r 'a'::
       
  1047   o  11:eb6d63fc4ed5 e
       
  1048   |
       
  1049   o  10:44d8c724a70c d'
       
  1050   |
       
  1051   o  9:d008e6b4d3fd c
       
  1052   |
       
  1053   o  8:67e8f4a16c49 b
       
  1054   |
       
  1055   | o  7:1143e9adc121 f
       
  1056   | |
       
  1057   | | x  6:d60ebfa0f1cb e (rewritten using rebase as 11:eb6d63fc4ed5)
       
  1058   | | |
       
  1059   | | x  5:027ad6c5830d d' (rewritten using rebase as 10:44d8c724a70c)
       
  1060   | | |
       
  1061   | x |  4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
       
  1062   | |/
       
  1063   | x  3:a82ac2b38757 c (rewritten using rebase as 9:d008e6b4d3fd)
       
  1064   | |
       
  1065   o |  2:630d7c95eff7 x
       
  1066   | |
       
  1067   | x  1:488e1b7e7341 b (rewritten using rebase as 8:67e8f4a16c49)
       
  1068   |/
       
  1069   o  0:b173517d0057 a
       
  1070   
       
  1071   $ hg strip -r 8:
       
  1072 
       
  1073 If the rebase set has an obsolete (d) with a successor (d') outside the rebase
       
  1074 set and none in destination, we still get the divergence warning.
       
  1075 By allowing divergence, we can perform the rebase.
       
  1076 
       
  1077   $ hg rebase -r 'c'::'f' -d 'x'
       
  1078   abort: this rebase will cause divergences from: 76be324c128b
       
  1079   (to force the rebase please set experimental.evolution.allowdivergence=True)
       
  1080   [255]
       
  1081   $ hg rebase --config experimental.evolution.allowdivergence=true -r 'c'::'f' -d 'x'
       
  1082   rebasing 3:a82ac2b38757 "c" (c)
       
  1083   rebasing 4:76be324c128b "d" (d)
       
  1084   rebasing 7:1143e9adc121 "f" (f tip)
       
  1085   $ hg log -G -r 'a':: -T instabilities
       
  1086   o  10:e1744ea07510 f
       
  1087   |
       
  1088   o  9:e2b36ea9a0a0 d (content-divergent)
       
  1089   |
       
  1090   o  8:6a0376de376e c
       
  1091   |
       
  1092   | x  7:1143e9adc121 f
       
  1093   | |
       
  1094   | | o  6:d60ebfa0f1cb e (orphan)
       
  1095   | | |
       
  1096   | | o  5:027ad6c5830d d' (orphan content-divergent)
       
  1097   | | |
       
  1098   | x |  4:76be324c128b d
       
  1099   | |/
       
  1100   | x  3:a82ac2b38757 c
       
  1101   | |
       
  1102   o |  2:630d7c95eff7 x
       
  1103   | |
       
  1104   | o  1:488e1b7e7341 b
       
  1105   |/
       
  1106   o  0:b173517d0057 a
       
  1107   
       
  1108   $ hg strip -r 8:
       
  1109 
       
  1110 (Not skipping obsoletes means that divergence is allowed.)
       
  1111 
       
  1112   $ hg rebase --config experimental.rebaseskipobsolete=false -r 'c'::'f' -d 'x'
       
  1113   rebasing 3:a82ac2b38757 "c" (c)
       
  1114   rebasing 4:76be324c128b "d" (d)
       
  1115   rebasing 7:1143e9adc121 "f" (f tip)
       
  1116 
       
  1117   $ hg strip -r 0:
       
  1118 
       
  1119 Similar test on a more complex graph
       
  1120 
       
  1121   $ hg debugdrawdag <<EOF
       
  1122   >       g
       
  1123   >       |
       
  1124   >   f   e
       
  1125   >   |   |
       
  1126   >   e'  d # replace: e -> e'
       
  1127   >    \ /
       
  1128   >     c
       
  1129   >     |
       
  1130   >   x b
       
  1131   >    \|
       
  1132   >     a
       
  1133   > EOF
       
  1134   $ hg log -G -r 'a':
       
  1135   o  8:2876ce66c6eb g
       
  1136   |
       
  1137   | o  7:3ffec603ab53 f
       
  1138   | |
       
  1139   x |  6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
       
  1140   | |
       
  1141   | o  5:63324dc512ea e'
       
  1142   | |
       
  1143   o |  4:76be324c128b d
       
  1144   |/
       
  1145   o  3:a82ac2b38757 c
       
  1146   |
       
  1147   | o  2:630d7c95eff7 x
       
  1148   | |
       
  1149   o |  1:488e1b7e7341 b
       
  1150   |/
       
  1151   o  0:b173517d0057 a
       
  1152   
       
  1153   $ hg rebase -b 'f' -d 'x'
       
  1154   rebasing 1:488e1b7e7341 "b" (b)
       
  1155   rebasing 3:a82ac2b38757 "c" (c)
       
  1156   rebasing 5:63324dc512ea "e'" (e')
       
  1157   rebasing 7:3ffec603ab53 "f" (f)
       
  1158   rebasing 4:76be324c128b "d" (d)
       
  1159   note: not rebasing 6:e36fae928aec "e" (e) and its descendants as this would cause divergence
       
  1160   $ hg log -G -r 'a':
       
  1161   o  13:a1707a5b7c2c d
       
  1162   |
       
  1163   | o  12:ef6251596616 f
       
  1164   | |
       
  1165   | o  11:b6f172e64af9 e'
       
  1166   |/
       
  1167   o  10:d008e6b4d3fd c
       
  1168   |
       
  1169   o  9:67e8f4a16c49 b
       
  1170   |
       
  1171   | o  8:2876ce66c6eb g
       
  1172   | |
       
  1173   | | x  7:3ffec603ab53 f (rewritten using rebase as 12:ef6251596616)
       
  1174   | | |
       
  1175   | x |  6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
       
  1176   | | |
       
  1177   | | x  5:63324dc512ea e' (rewritten using rebase as 11:b6f172e64af9)
       
  1178   | | |
       
  1179   | x |  4:76be324c128b d (rewritten using rebase as 13:a1707a5b7c2c)
       
  1180   | |/
       
  1181   | x  3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd)
       
  1182   | |
       
  1183   o |  2:630d7c95eff7 x
       
  1184   | |
       
  1185   | x  1:488e1b7e7341 b (rewritten using rebase as 9:67e8f4a16c49)
       
  1186   |/
       
  1187   o  0:b173517d0057 a
       
  1188   
       
  1189 
   988   $ cd ..
  1190   $ cd ..
   989 
  1191 
   990 Rebase merge where successor of one parent is equal to destination (issue5198)
  1192 Rebase merge where successor of one parent is equal to destination (issue5198)
   991 
  1193 
   992   $ hg init p1-succ-is-dest
  1194   $ hg init p1-succ-is-dest