##// END OF EJS Templates
grep: make -frREV follow history from the specified revision (BC)...
Yuya Nishihara -
r46052:8ceb5b4b default
parent child Browse files
Show More
@@ -2254,8 +2254,12 b' def _walkrevs(repo, opts):'
2254 2254 # Default --rev value depends on --follow but --follow behavior
2255 2255 # depends on revisions resolved from --rev...
2256 2256 follow = opts.get(b'follow') or opts.get(b'follow_first')
2257 if opts.get(b'rev'):
2258 revs = scmutil.revrange(repo, opts[b'rev'])
2257 revspec = opts.get(b'rev')
2258 if follow and revspec:
2259 revs = scmutil.revrange(repo, revspec)
2260 revs = repo.revs(b'reverse(::%ld)', revs)
2261 elif revspec:
2262 revs = scmutil.revrange(repo, revspec)
2259 2263 elif follow and repo.dirstate.p1() == nullid:
2260 2264 revs = smartset.baseset()
2261 2265 elif follow:
@@ -949,12 +949,18 b' follow revision history from specified r'
949 949 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
950 950 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
951 951
952 BROKEN: should follow history
953 952 $ hg grep --diff -fr2 data
954 953 add0-cp2-mod2:2:+:data2
955 954 add0-mod2:2:+:data2
955 add0:0:+:data0
956 add0-mod1:0:+:data0
957 add0-mod2:0:+:data0
958 add0-mod3:0:+:data0
959 add0-mod4:0:+:data0
960 add0-rm1:0:+:data0
961 add0-rm2:0:+:data0
962 add0-rm4:0:+:data0
956 963
957 BROKEN: should follow history
958 964 $ hg grep -fr2 data
959 965 add0:2:data0
960 966 add0-cp2:2:data0
@@ -967,6 +973,14 b' follow revision history from specified r'
967 973 add0-mod4:2:data0
968 974 add0-rm1:2:data0
969 975 add0-rm4:2:data0
976 add0:0:data0
977 add0-mod1:0:data0
978 add0-mod2:0:data0
979 add0-mod3:0:data0
980 add0-mod4:0:data0
981 add0-rm1:0:data0
982 add0-rm2:0:data0
983 add0-rm4:0:data0
970 984
971 985 follow revision history from wdir:
972 986
@@ -984,7 +998,6 b' follow revision history from wdir:'
984 998 add0-rm4:2147483647:-:abort: add0-rm4@None: not found in manifest!
985 999 [255]
986 1000
987 BROKEN: should follow history
988 1001 $ hg grep -fr'wdir()' data
989 1002 add0:2147483647:data0
990 1003 add0-cp1:2147483647:data0
@@ -1005,24 +1018,22 b' follow revision history from wdir:'
1005 1018 add0-mod4:2147483647:data0
1006 1019 add0-mod4:2147483647:data4
1007 1020 add0-rm2:2147483647:data0
1008
1009 follow revision history from multiple revisions:
1010
1011 $ hg log -fr'1+2'
1012 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1013 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
1014 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1015
1016 BROKEN: should follow history
1017 BROKEN: should include the revision 2
1018 $ hg grep --diff -fr'1+2' data
1019 add0-cp1-mod1:1:+:data1
1020 add0-cp1-mod1-rm3:1:+:data1
1021 add0-mod1:1:+:data1
1022
1023 BROKEN: should follow history
1024 BROKEN: should include the revision 2
1025 $ hg grep -fr'1+2' data
1021 add0:3:data0
1022 add0-cp1:3:data0
1023 add0-cp1-cp3:3:data0
1024 add0-cp1-mod1:3:data0
1025 add0-cp1-mod1:3:data1
1026 add0-cp1-mod1-cp3-mod3:3:data0
1027 add0-cp1-mod1-cp3-mod3:3:data1
1028 add0-cp1-mod1-cp3-mod3:3:data3
1029 add0-mod1:3:data0
1030 add0-mod1:3:data1
1031 add0-mod2:3:data0
1032 add0-mod3:3:data0
1033 add0-mod3:3:data3
1034 add0-mod4:3:data0
1035 add0-rm2:3:data0
1036 add0-rm4:3:data0
1026 1037 add0:1:data0
1027 1038 add0-cp1:1:data0
1028 1039 add0-cp1-mod1:1:data0
@@ -1036,6 +1047,56 b' follow revision history from multiple re'
1036 1047 add0-mod4:1:data0
1037 1048 add0-rm2:1:data0
1038 1049 add0-rm4:1:data0
1050 add0:0:data0
1051 add0-mod1:0:data0
1052 add0-mod2:0:data0
1053 add0-mod3:0:data0
1054 add0-mod4:0:data0
1055 add0-rm1:0:data0
1056 add0-rm2:0:data0
1057 add0-rm4:0:data0
1058
1059 follow revision history from multiple revisions:
1060
1061 $ hg log -fr'1+2'
1062 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1063 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
1064 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1065
1066 BROKEN: should include the revision 1
1067 $ hg grep --diff -fr'1+2' data
1068 add0-cp2-mod2:2:+:data2
1069 add0-mod2:2:+:data2
1070 add0:0:+:data0
1071 add0-mod1:0:+:data0
1072 add0-mod2:0:+:data0
1073 add0-mod3:0:+:data0
1074 add0-mod4:0:+:data0
1075 add0-rm1:0:+:data0
1076 add0-rm2:0:+:data0
1077 add0-rm4:0:+:data0
1078
1079 BROKEN: should include the revision 1
1080 $ hg grep -fr'1+2' data
1081 add0:2:data0
1082 add0-cp2:2:data0
1083 add0-cp2-mod2:2:data0
1084 add0-cp2-mod2:2:data2
1085 add0-mod1:2:data0
1086 add0-mod2:2:data0
1087 add0-mod2:2:data2
1088 add0-mod3:2:data0
1089 add0-mod4:2:data0
1090 add0-rm1:2:data0
1091 add0-rm4:2:data0
1092 add0:0:data0
1093 add0-mod1:0:data0
1094 add0-mod2:0:data0
1095 add0-mod3:0:data0
1096 add0-mod4:0:data0
1097 add0-rm1:0:data0
1098 add0-rm2:0:data0
1099 add0-rm4:0:data0
1039 1100
1040 1101 follow file history from wdir parent, unmodified in wdir:
1041 1102
@@ -1143,7 +1204,8 b' follow file history from wdir parent (ex'
1143 1204
1144 1205 BROKEN: should abort
1145 1206 $ hg grep -fr. data add0-cp1-mod1-rm3
1146 [1]
1207 add0-cp1-mod1-rm3:1:data0
1208 add0-cp1-mod1-rm3:1:data1
1147 1209
1148 1210 follow file history from wdir parent, removed in wdir:
1149 1211
@@ -1167,13 +1229,13 b' follow file history from wdir parent (ex'
1167 1229 $ hg log -fr. add0-rm4
1168 1230 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1169 1231
1170 BROKEN: should follow history
1171 1232 $ hg grep --diff -fr. data add0-rm4
1172 [1]
1233 add0-rm4:0:+:data0
1173 1234
1174 BROKEN: should follow history
1175 1235 $ hg grep -fr. data add0-rm4
1176 1236 add0-rm4:3:data0
1237 add0-rm4:1:data0
1238 add0-rm4:0:data0
1177 1239
1178 1240 follow file history from wdir parent, multiple files:
1179 1241
@@ -1207,14 +1269,14 b' follow file history from specified revis'
1207 1269 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1208 1270 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1209 1271
1210 BROKEN: should follow history from the specified revision
1272 BROKEN: should include the revision 2
1211 1273 $ hg grep --diff -fr2 data add0-mod2
1212 [1]
1274 add0-mod2:0:+:data0
1213 1275
1214 BROKEN: should follow history
1215 1276 $ hg grep -fr2 data add0-mod2
1216 1277 add0-mod2:2:data0
1217 1278 add0-mod2:2:data2
1279 add0-mod2:0:data0
1218 1280
1219 1281 follow file history from specified revision, copied but unmodified:
1220 1282
@@ -1255,11 +1317,11 b' follow file history from specified revis'
1255 1317
1256 1318 BROKEN: should abort
1257 1319 $ hg grep --diff -fr2 data add0-rm2
1258 [1]
1320 add0-rm2:0:+:data0
1259 1321
1260 1322 BROKEN: should abort
1261 1323 $ hg grep -fr2 data add0-rm2
1262 [1]
1324 add0-rm2:0:data0
1263 1325
1264 1326 follow file history from specified revision, multiple files:
1265 1327
@@ -1272,11 +1334,12 b' follow file history from specified revis'
1272 1334 abort: cannot follow file not in parent revision: "add0-cp2"
1273 1335 [255]
1274 1336
1275 BROKEN: should follow history
1337 BROKEN: should follow history across renames
1276 1338 $ hg grep -fr2 data add0-cp2 add0-mod2
1277 1339 add0-cp2:2:data0
1278 1340 add0-mod2:2:data0
1279 1341 add0-mod2:2:data2
1342 add0-mod2:0:data0
1280 1343
1281 1344 follow file history from wdir, unmodified:
1282 1345
@@ -1285,14 +1348,17 b' follow file history from wdir, unmodifie'
1285 1348 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1286 1349 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1287 1350
1288 BROKEN: should follow history
1289 1351 $ hg grep --diff -fr'wdir()' data add0-mod3
1290 [1]
1352 add0-mod3:3:+:data3
1353 add0-mod3:0:+:data0
1291 1354
1292 BROKEN: should follow history
1293 1355 $ hg grep -fr'wdir()' data add0-mod3
1294 1356 add0-mod3:2147483647:data0
1295 1357 add0-mod3:2147483647:data3
1358 add0-mod3:3:data0
1359 add0-mod3:3:data3
1360 add0-mod3:1:data0
1361 add0-mod3:0:data0
1296 1362
1297 1363 follow file history from wdir, modified:
1298 1364
@@ -1300,14 +1366,16 b' follow file history from wdir, modified:'
1300 1366 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1301 1367 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1302 1368
1303 BROKEN: should follow history and show the changes in wdir
1369 BROKEN: should include the changes in wdir
1304 1370 $ hg grep --diff -fr'wdir()' data add0-mod4
1305 [1]
1371 add0-mod4:0:+:data0
1306 1372
1307 BROKEN: should follow history
1308 1373 $ hg grep -fr'wdir()' data add0-mod4
1309 1374 add0-mod4:2147483647:data0
1310 1375 add0-mod4:2147483647:data4
1376 add0-mod4:3:data0
1377 add0-mod4:1:data0
1378 add0-mod4:0:data0
1311 1379
1312 1380 follow file history from wdir, copied but unmodified:
1313 1381
@@ -1352,12 +1420,19 b' follow file history from wdir, multiple '
1352 1420 abort: cannot follow file not in parent revision: "add0-cp4"
1353 1421 [255]
1354 1422
1355 BROKEN: should follow history
1423 BROKEN: should follow history across renames
1356 1424 $ hg grep -fr'wdir()' data add0-cp4 add0-mod4 add0-mod3
1357 1425 add0-cp4:2147483647:data0
1358 1426 add0-mod3:2147483647:data0
1359 1427 add0-mod3:2147483647:data3
1360 1428 add0-mod4:2147483647:data0
1361 1429 add0-mod4:2147483647:data4
1430 add0-mod3:3:data0
1431 add0-mod3:3:data3
1432 add0-mod4:3:data0
1433 add0-mod3:1:data0
1434 add0-mod4:1:data0
1435 add0-mod3:0:data0
1436 add0-mod4:0:data0
1362 1437
1363 1438 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now