##// 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 # Default --rev value depends on --follow but --follow behavior
2254 # Default --rev value depends on --follow but --follow behavior
2255 # depends on revisions resolved from --rev...
2255 # depends on revisions resolved from --rev...
2256 follow = opts.get(b'follow') or opts.get(b'follow_first')
2256 follow = opts.get(b'follow') or opts.get(b'follow_first')
2257 if opts.get(b'rev'):
2257 revspec = opts.get(b'rev')
2258 revs = scmutil.revrange(repo, opts[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 elif follow and repo.dirstate.p1() == nullid:
2263 elif follow and repo.dirstate.p1() == nullid:
2260 revs = smartset.baseset()
2264 revs = smartset.baseset()
2261 elif follow:
2265 elif follow:
@@ -949,12 +949,18 b' follow revision history from specified r'
949 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
949 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
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
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 $ hg grep --diff -fr2 data
952 $ hg grep --diff -fr2 data
954 add0-cp2-mod2:2:+:data2
953 add0-cp2-mod2:2:+:data2
955 add0-mod2:2:+:data2
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 $ hg grep -fr2 data
964 $ hg grep -fr2 data
959 add0:2:data0
965 add0:2:data0
960 add0-cp2:2:data0
966 add0-cp2:2:data0
@@ -967,6 +973,14 b' follow revision history from specified r'
967 add0-mod4:2:data0
973 add0-mod4:2:data0
968 add0-rm1:2:data0
974 add0-rm1:2:data0
969 add0-rm4:2:data0
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 follow revision history from wdir:
985 follow revision history from wdir:
972
986
@@ -984,7 +998,6 b' follow revision history from wdir:'
984 add0-rm4:2147483647:-:abort: add0-rm4@None: not found in manifest!
998 add0-rm4:2147483647:-:abort: add0-rm4@None: not found in manifest!
985 [255]
999 [255]
986
1000
987 BROKEN: should follow history
988 $ hg grep -fr'wdir()' data
1001 $ hg grep -fr'wdir()' data
989 add0:2147483647:data0
1002 add0:2147483647:data0
990 add0-cp1:2147483647:data0
1003 add0-cp1:2147483647:data0
@@ -1005,24 +1018,22 b' follow revision history from wdir:'
1005 add0-mod4:2147483647:data0
1018 add0-mod4:2147483647:data0
1006 add0-mod4:2147483647:data4
1019 add0-mod4:2147483647:data4
1007 add0-rm2:2147483647:data0
1020 add0-rm2:2147483647:data0
1008
1021 add0:3:data0
1009 follow revision history from multiple revisions:
1022 add0-cp1:3:data0
1010
1023 add0-cp1-cp3:3:data0
1011 $ hg log -fr'1+2'
1024 add0-cp1-mod1:3:data0
1012 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1025 add0-cp1-mod1:3:data1
1013 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
1026 add0-cp1-mod1-cp3-mod3:3:data0
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
1027 add0-cp1-mod1-cp3-mod3:3:data1
1015
1028 add0-cp1-mod1-cp3-mod3:3:data3
1016 BROKEN: should follow history
1029 add0-mod1:3:data0
1017 BROKEN: should include the revision 2
1030 add0-mod1:3:data1
1018 $ hg grep --diff -fr'1+2' data
1031 add0-mod2:3:data0
1019 add0-cp1-mod1:1:+:data1
1032 add0-mod3:3:data0
1020 add0-cp1-mod1-rm3:1:+:data1
1033 add0-mod3:3:data3
1021 add0-mod1:1:+:data1
1034 add0-mod4:3:data0
1022
1035 add0-rm2:3:data0
1023 BROKEN: should follow history
1036 add0-rm4:3:data0
1024 BROKEN: should include the revision 2
1025 $ hg grep -fr'1+2' data
1026 add0:1:data0
1037 add0:1:data0
1027 add0-cp1:1:data0
1038 add0-cp1:1:data0
1028 add0-cp1-mod1:1:data0
1039 add0-cp1-mod1:1:data0
@@ -1036,6 +1047,56 b' follow revision history from multiple re'
1036 add0-mod4:1:data0
1047 add0-mod4:1:data0
1037 add0-rm2:1:data0
1048 add0-rm2:1:data0
1038 add0-rm4:1:data0
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 follow file history from wdir parent, unmodified in wdir:
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 BROKEN: should abort
1205 BROKEN: should abort
1145 $ hg grep -fr. data add0-cp1-mod1-rm3
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 follow file history from wdir parent, removed in wdir:
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 $ hg log -fr. add0-rm4
1229 $ hg log -fr. add0-rm4
1168 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
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 $ hg grep --diff -fr. data add0-rm4
1232 $ hg grep --diff -fr. data add0-rm4
1172 [1]
1233 add0-rm4:0:+:data0
1173
1234
1174 BROKEN: should follow history
1175 $ hg grep -fr. data add0-rm4
1235 $ hg grep -fr. data add0-rm4
1176 add0-rm4:3:data0
1236 add0-rm4:3:data0
1237 add0-rm4:1:data0
1238 add0-rm4:0:data0
1177
1239
1178 follow file history from wdir parent, multiple files:
1240 follow file history from wdir parent, multiple files:
1179
1241
@@ -1207,14 +1269,14 b' follow file history from specified revis'
1207 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1269 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1208 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
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 $ hg grep --diff -fr2 data add0-mod2
1273 $ hg grep --diff -fr2 data add0-mod2
1212 [1]
1274 add0-mod2:0:+:data0
1213
1275
1214 BROKEN: should follow history
1215 $ hg grep -fr2 data add0-mod2
1276 $ hg grep -fr2 data add0-mod2
1216 add0-mod2:2:data0
1277 add0-mod2:2:data0
1217 add0-mod2:2:data2
1278 add0-mod2:2:data2
1279 add0-mod2:0:data0
1218
1280
1219 follow file history from specified revision, copied but unmodified:
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 BROKEN: should abort
1318 BROKEN: should abort
1257 $ hg grep --diff -fr2 data add0-rm2
1319 $ hg grep --diff -fr2 data add0-rm2
1258 [1]
1320 add0-rm2:0:+:data0
1259
1321
1260 BROKEN: should abort
1322 BROKEN: should abort
1261 $ hg grep -fr2 data add0-rm2
1323 $ hg grep -fr2 data add0-rm2
1262 [1]
1324 add0-rm2:0:data0
1263
1325
1264 follow file history from specified revision, multiple files:
1326 follow file history from specified revision, multiple files:
1265
1327
@@ -1272,11 +1334,12 b' follow file history from specified revis'
1272 abort: cannot follow file not in parent revision: "add0-cp2"
1334 abort: cannot follow file not in parent revision: "add0-cp2"
1273 [255]
1335 [255]
1274
1336
1275 BROKEN: should follow history
1337 BROKEN: should follow history across renames
1276 $ hg grep -fr2 data add0-cp2 add0-mod2
1338 $ hg grep -fr2 data add0-cp2 add0-mod2
1277 add0-cp2:2:data0
1339 add0-cp2:2:data0
1278 add0-mod2:2:data0
1340 add0-mod2:2:data0
1279 add0-mod2:2:data2
1341 add0-mod2:2:data2
1342 add0-mod2:0:data0
1280
1343
1281 follow file history from wdir, unmodified:
1344 follow file history from wdir, unmodified:
1282
1345
@@ -1285,14 +1348,17 b' follow file history from wdir, unmodifie'
1285 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1348 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1286 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
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 $ hg grep --diff -fr'wdir()' data add0-mod3
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 $ hg grep -fr'wdir()' data add0-mod3
1355 $ hg grep -fr'wdir()' data add0-mod3
1294 add0-mod3:2147483647:data0
1356 add0-mod3:2147483647:data0
1295 add0-mod3:2147483647:data3
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 follow file history from wdir, modified:
1363 follow file history from wdir, modified:
1298
1364
@@ -1300,14 +1366,16 b' follow file history from wdir, modified:'
1300 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1366 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1301 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
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 $ hg grep --diff -fr'wdir()' data add0-mod4
1370 $ hg grep --diff -fr'wdir()' data add0-mod4
1305 [1]
1371 add0-mod4:0:+:data0
1306
1372
1307 BROKEN: should follow history
1308 $ hg grep -fr'wdir()' data add0-mod4
1373 $ hg grep -fr'wdir()' data add0-mod4
1309 add0-mod4:2147483647:data0
1374 add0-mod4:2147483647:data0
1310 add0-mod4:2147483647:data4
1375 add0-mod4:2147483647:data4
1376 add0-mod4:3:data0
1377 add0-mod4:1:data0
1378 add0-mod4:0:data0
1311
1379
1312 follow file history from wdir, copied but unmodified:
1380 follow file history from wdir, copied but unmodified:
1313
1381
@@ -1352,12 +1420,19 b' follow file history from wdir, multiple '
1352 abort: cannot follow file not in parent revision: "add0-cp4"
1420 abort: cannot follow file not in parent revision: "add0-cp4"
1353 [255]
1421 [255]
1354
1422
1355 BROKEN: should follow history
1423 BROKEN: should follow history across renames
1356 $ hg grep -fr'wdir()' data add0-cp4 add0-mod4 add0-mod3
1424 $ hg grep -fr'wdir()' data add0-cp4 add0-mod4 add0-mod3
1357 add0-cp4:2147483647:data0
1425 add0-cp4:2147483647:data0
1358 add0-mod3:2147483647:data0
1426 add0-mod3:2147483647:data0
1359 add0-mod3:2147483647:data3
1427 add0-mod3:2147483647:data3
1360 add0-mod4:2147483647:data0
1428 add0-mod4:2147483647:data0
1361 add0-mod4:2147483647:data4
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 $ cd ..
1438 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now