##// END OF EJS Templates
hgweb: filter diff hunks when 'linerange' and 'patch' are specified in filelog
Denis Laxalde -
r31667:e540846c default
parent child Browse files
Show More
@@ -993,11 +993,12 b' def filelog(web, req, tmpl):'
993 if 'style' in req.form:
993 if 'style' in req.form:
994 diffstyle = req.form['style'][0]
994 diffstyle = req.form['style'][0]
995
995
996 def diff(fctx):
996 def diff(fctx, linerange=None):
997 ctx = fctx.changectx()
997 ctx = fctx.changectx()
998 basectx = ctx.p1()
998 basectx = ctx.p1()
999 path = fctx.path()
999 path = fctx.path()
1000 return webutil.diffs(web, tmpl, ctx, basectx, [path], diffstyle)
1000 return webutil.diffs(web, tmpl, ctx, basectx, [path], diffstyle,
1001 linerange=linerange)
1001
1002
1002 linerange = None
1003 linerange = None
1003 if lrange is not None:
1004 if lrange is not None:
@@ -1009,7 +1010,7 b' def filelog(web, req, tmpl):'
1009 for i, (c, lr) in enumerate(ancestors, 1):
1010 for i, (c, lr) in enumerate(ancestors, 1):
1010 diffs = None
1011 diffs = None
1011 if patch:
1012 if patch:
1012 diffs = diff(c)
1013 diffs = diff(c, linerange=lr)
1013 # follow renames accross filtered (not in range) revisions
1014 # follow renames accross filtered (not in range) revisions
1014 path = c.path()
1015 path = c.path()
1015 entries.append(dict(
1016 entries.append(dict(
@@ -1159,6 +1159,328 b' filelog with patch'
1159 </body>
1159 </body>
1160 </html>
1160 </html>
1161
1161
1162 filelog with 'linerange' and 'patch'
1163
1164 $ cat c
1165 b
1166 c
1167 $ cat <<EOF > c
1168 > b
1169 > c+
1170 >
1171 > a
1172 > a
1173 >
1174 > d
1175 > e
1176 > f
1177 > EOF
1178 $ hg ci -m 'make c bigger and touch its beginning' c
1179 $ cat <<EOF > c
1180 > b
1181 > c+
1182 >
1183 > a
1184 > a
1185 >
1186 > d
1187 > e+
1188 > f
1189 > EOF
1190 $ hg ci -m 'just touch end of c' c
1191 $ cat <<EOF > c
1192 > b
1193 > c++
1194 >
1195 > a
1196 > a
1197 >
1198 > d
1199 > e+
1200 > f
1201 > EOF
1202 $ hg ci -m 'touch beginning of c' c
1203 $ cat <<EOF > c
1204 > b-
1205 > c++
1206 >
1207 > a
1208 > a
1209 >
1210 > d
1211 > e+
1212 > f+
1213 > EOF
1214 $ hg ci -m 'touching beginning and end of c' c
1215 $ hg log -r 'followlines(c, 1:2, startrev=tip) and follow(c)' -p
1216 changeset: 0:6563da9dcf87
1217 user: test
1218 date: Thu Jan 01 00:00:00 1970 +0000
1219 summary: b
1220
1221 diff -r 000000000000 -r 6563da9dcf87 b
1222 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1223 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1224 @@ -0,0 +1,1 @@
1225 +b
1226
1227 changeset: 7:46c1a66bd8fc
1228 branch: a-branch
1229 user: test
1230 date: Thu Jan 01 00:00:00 1970 +0000
1231 summary: change c
1232
1233 diff -r c9637d3cc8ef -r 46c1a66bd8fc c
1234 --- a/c Thu Jan 01 00:00:00 1970 +0000
1235 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1236 @@ -1,1 +1,2 @@
1237 b
1238 +c
1239
1240 changeset: 8:c40702dbfc57
1241 branch: a-branch
1242 user: test
1243 date: Thu Jan 01 00:00:00 1970 +0000
1244 summary: make c bigger and touch its beginning
1245
1246 diff -r 46c1a66bd8fc -r c40702dbfc57 c
1247 --- a/c Thu Jan 01 00:00:00 1970 +0000
1248 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1249 @@ -1,2 +1,9 @@
1250 b
1251 -c
1252 +c+
1253 +
1254 +a
1255 +a
1256 +
1257 +d
1258 +e
1259 +f
1260
1261 changeset: 10:f94018eca295
1262 branch: a-branch
1263 user: test
1264 date: Thu Jan 01 00:00:00 1970 +0000
1265 summary: touch beginning of c
1266
1267 diff -r 07faa31d6d1c -r f94018eca295 c
1268 --- a/c Thu Jan 01 00:00:00 1970 +0000
1269 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1270 @@ -1,5 +1,5 @@
1271 b
1272 -c+
1273 +c++
1274
1275 a
1276 a
1277
1278 changeset: 11:ea4193bdd9bf
1279 branch: a-branch
1280 tag: tip
1281 user: test
1282 date: Thu Jan 01 00:00:00 1970 +0000
1283 summary: touching beginning and end of c
1284
1285 diff -r f94018eca295 -r ea4193bdd9bf c
1286 --- a/c Thu Jan 01 00:00:00 1970 +0000
1287 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1288 @@ -1,4 +1,4 @@
1289 -b
1290 +b-
1291 c++
1292
1293 a
1294 @@ -6,4 +6,4 @@
1295
1296 d
1297 e+
1298 -f
1299 +f+
1300
1301 $ (get-with-headers.py localhost:$HGPORT 'log/tip/c?linerange=1:2&patch=')
1302 200 Script output follows
1303
1304 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1305 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1306 <head>
1307 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1308 <meta name="robots" content="index, nofollow" />
1309 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1310 <script type="text/javascript" src="/static/mercurial.js"></script>
1311
1312 <title>test: c history</title>
1313 <link rel="alternate" type="application/atom+xml"
1314 href="/atom-log/tip/c" title="Atom feed for test:c" />
1315 <link rel="alternate" type="application/rss+xml"
1316 href="/rss-log/tip/c" title="RSS feed for test:c" />
1317 </head>
1318 <body>
1319
1320 <div class="container">
1321 <div class="menu">
1322 <div class="logo">
1323 <a href="https://mercurial-scm.org/">
1324 <img src="/static/hglogo.png" alt="mercurial" /></a>
1325 </div>
1326 <ul>
1327 <li><a href="/shortlog/tip">log</a></li>
1328 <li><a href="/graph/tip">graph</a></li>
1329 <li><a href="/tags">tags</a></li>
1330 <li><a href="/bookmarks">bookmarks</a></li>
1331 <li><a href="/branches">branches</a></li>
1332 </ul>
1333 <ul>
1334 <li><a href="/rev/tip">changeset</a></li>
1335 <li><a href="/file/tip">browse</a></li>
1336 </ul>
1337 <ul>
1338 <li><a href="/file/tip/c">file</a></li>
1339 <li><a href="/diff/tip/c">diff</a></li>
1340 <li><a href="/comparison/tip/c">comparison</a></li>
1341 <li><a href="/annotate/tip/c">annotate</a></li>
1342 <li class="active">file log</li>
1343 <li><a href="/raw-file/tip/c">raw</a></li>
1344 </ul>
1345 <ul>
1346 <li><a href="/help">help</a></li>
1347 </ul>
1348 <div class="atom-logo">
1349 <a href="/atom-log/tip/c" title="subscribe to atom feed">
1350 <img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed" />
1351 </a>
1352 </div>
1353 </div>
1354
1355 <div class="main">
1356 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1357 <h3>
1358 log c @ 11:<a href="/rev/ea4193bdd9bf">ea4193bdd9bf</a>
1359 <span class="branchname">a-branch</span> <span class="tag">tip</span>
1360 (following lines 1:2 <a href="/log/tip/c">back to filelog</a>)
1361 </h3>
1362
1363 <form class="search" action="/log">
1364
1365 <p><input name="rev" id="search1" type="text" size="30" /></p>
1366 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1367 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1368 </form>
1369
1370 <div class="navigate">
1371 <a href="/log/tip/c?linerange=1%3A2&patch=&revcount=30">less</a>
1372 <a href="/log/tip/c?linerange=1%3A2&patch=&revcount=120">more</a>
1373 | </div>
1374
1375 <table class="bigtable">
1376 <thead>
1377 <tr>
1378 <th class="age">age</th>
1379 <th class="author">author</th>
1380 <th class="description">description</th>
1381 </tr>
1382 </thead>
1383 <tbody class="stripes2">
1384 <tr>
1385 <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>
1386 <td class="author">test</td>
1387 <td class="description">
1388 <a href="/rev/ea4193bdd9bf">touching beginning and end of c</a>
1389 <span class="branchhead">a-branch</span> <span class="tag">tip</span>
1390 </td>
1391 </tr>
1392 <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
1393 <span id="l1.1" class="minusline">--- a/c Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.1"></a>
1394 <span id="l1.2" class="plusline">+++ b/c Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.2"></a>
1395 <span id="l1.3" class="atline">@@ -1,4 +1,4 @@</span><a href="#l1.3"></a>
1396 <span id="l1.4" class="minusline">-b</span><a href="#l1.4"></a>
1397 <span id="l1.5" class="plusline">+b-</span><a href="#l1.5"></a>
1398 <span id="l1.6"> c++</span><a href="#l1.6"></a>
1399 <span id="l1.7"> </span><a href="#l1.7"></a>
1400 <span id="l1.8"> a</span><a href="#l1.8"></a></pre></div></td></tr>
1401 <tr>
1402 <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>
1403 <td class="author">test</td>
1404 <td class="description">
1405 <a href="/rev/f94018eca295">touch beginning of c</a>
1406 <span class="branchname">a-branch</span>
1407 </td>
1408 </tr>
1409 <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
1410 <span id="l1.1" class="minusline">--- a/c Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.1"></a>
1411 <span id="l1.2" class="plusline">+++ b/c Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.2"></a>
1412 <span id="l1.3" class="atline">@@ -1,5 +1,5 @@</span><a href="#l1.3"></a>
1413 <span id="l1.4"> b</span><a href="#l1.4"></a>
1414 <span id="l1.5" class="minusline">-c+</span><a href="#l1.5"></a>
1415 <span id="l1.6" class="plusline">+c++</span><a href="#l1.6"></a>
1416 <span id="l1.7"> </span><a href="#l1.7"></a>
1417 <span id="l1.8"> a</span><a href="#l1.8"></a>
1418 <span id="l1.9"> a</span><a href="#l1.9"></a></pre></div></td></tr>
1419 <tr>
1420 <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>
1421 <td class="author">test</td>
1422 <td class="description">
1423 <a href="/rev/c40702dbfc57">make c bigger and touch its beginning</a>
1424 <span class="branchname">a-branch</span>
1425 </td>
1426 </tr>
1427 <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
1428 <span id="l1.1" class="minusline">--- a/c Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.1"></a>
1429 <span id="l1.2" class="plusline">+++ b/c Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.2"></a>
1430 <span id="l1.3" class="atline">@@ -1,2 +1,9 @@</span><a href="#l1.3"></a>
1431 <span id="l1.4"> b</span><a href="#l1.4"></a>
1432 <span id="l1.5" class="minusline">-c</span><a href="#l1.5"></a>
1433 <span id="l1.6" class="plusline">+c+</span><a href="#l1.6"></a>
1434 <span id="l1.7" class="plusline">+</span><a href="#l1.7"></a>
1435 <span id="l1.8" class="plusline">+a</span><a href="#l1.8"></a>
1436 <span id="l1.9" class="plusline">+a</span><a href="#l1.9"></a>
1437 <span id="l1.10" class="plusline">+</span><a href="#l1.10"></a>
1438 <span id="l1.11" class="plusline">+d</span><a href="#l1.11"></a>
1439 <span id="l1.12" class="plusline">+e</span><a href="#l1.12"></a>
1440 <span id="l1.13" class="plusline">+f</span><a href="#l1.13"></a></pre></div></td></tr>
1441 <tr>
1442 <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>
1443 <td class="author">test</td>
1444 <td class="description">
1445 <a href="/rev/46c1a66bd8fc">change c</a>
1446 <span class="branchname">a-branch</span>
1447 </td>
1448 </tr>
1449 <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
1450 <span id="l1.1" class="minusline">--- a/c Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.1"></a>
1451 <span id="l1.2" class="plusline">+++ b/c Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.2"></a>
1452 <span id="l1.3" class="atline">@@ -1,1 +1,2 @@</span><a href="#l1.3"></a>
1453 <span id="l1.4"> b</span><a href="#l1.4"></a>
1454 <span id="l1.5" class="plusline">+c</span><a href="#l1.5"></a></pre></div></td></tr>
1455 <tr>
1456 <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>
1457 <td class="author">test</td>
1458 <td class="description">
1459 <a href="/rev/6563da9dcf87">b</a>
1460
1461 </td>
1462 </tr>
1463 <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
1464 <span id="l1.1" class="minusline">--- /dev/null Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.1"></a>
1465 <span id="l1.2" class="plusline">+++ b/b Thu Jan 01 00:00:00 1970 +0000</span><a href="#l1.2"></a></pre></div></td></tr>
1466
1467 </tbody>
1468 </table>
1469
1470 <div class="navigate">
1471 <a href="/log/tip/c?linerange=1%3A2&patch=&revcount=30">less</a>
1472 <a href="/log/tip/c?linerange=1%3A2&patch=&revcount=120">more</a>
1473 |
1474 </div>
1475
1476 </div>
1477 </div>
1478
1479
1480
1481 </body>
1482 </html>
1483
1162
1484
1163 rss log
1485 rss log
1164
1486
General Comments 0
You need to be logged in to leave comments. Login now