paper, coal: display diffstat on the changeset page
Displayed in a row of the changeset summary table, underneath the list of
files. When the page is loaded, only the diff summary is displayed. The full
diffstat is only displayed when the [+] link is selected.
--- a/mercurial/templates/paper/changeset.tmpl Sat Jun 11 21:11:43 2011 +0800
+++ b/mercurial/templates/paper/changeset.tmpl Sat Jun 11 21:24:50 2011 +0800
@@ -62,6 +62,18 @@
<th class="files">files</th>
<td class="files">{files}</td>
</tr>
+<tr>
+ <th class="diffstat">diffstat</th>
+ <td class="diffstat">
+ {diffsummary}
+ <a id="diffstatexpand" href="javascript:showDiffstat()"/>[+]</a>
+ <div id="diffstatdetails" style="display:none;">
+ <a href="javascript:hideDiffstat()"/>[-]</a>
+ <p>
+ <table>{diffstat}</table>
+ </div>
+ </td>
+</tr>
</table>
<div class="overflow">
--- a/mercurial/templates/static/mercurial.js Sat Jun 11 21:11:43 2011 +0800
+++ b/mercurial/templates/static/mercurial.js Sat Jun 11 21:24:50 2011 +0800
@@ -2,6 +2,7 @@
//
// Rendering of branch DAGs on the client side
// Display of elapsed time
+// Show or hide diffstat
//
// Copyright 2008 Dirkjan Ochtman <dirkjan AT ochtman DOT nl>
// Copyright 2006 Alexander Schremmer <alex AT alexanderweb DOT de>
@@ -218,3 +219,13 @@
}
}
})(document, RegExp, Math, isNaN, Date, false, true)
+
+function showDiffstat() {
+ document.getElementById('diffstatdetails').style.display = 'inline';
+ document.getElementById('diffstatexpand').style.display = 'none';
+}
+
+function hideDiffstat() {
+ document.getElementById('diffstatdetails').style.display = 'none';
+ document.getElementById('diffstatexpand').style.display = 'inline';
+}
--- a/tests/test-hgweb-commands.t Sat Jun 11 21:11:43 2011 +0800
+++ b/tests/test-hgweb-commands.t Sat Jun 11 21:24:50 2011 +0800
@@ -352,6 +352,35 @@
<th class="files">files</th>
<td class="files"><a href="/file/2ef0ac749a14/da/foo">da/foo</a> <a href="/file/2ef0ac749a14/foo">foo</a> </td>
</tr>
+ <tr>
+ <th class="diffstat">diffstat</th>
+ <td class="diffstat">
+ 2 files changed, 2 insertions(+), 0 deletions(-)
+
+ <a id="diffstatexpand" href="javascript:showDiffstat()"/>[+]</a>
+ <div id="diffstatdetails" style="display:none;">
+ <a href="javascript:hideDiffstat()"/>[-]</a>
+ <p>
+ <table> <tr class="parity0">
+ <td class="diffstat-file"><a href="#l1.1">da/foo</a></td>
+ <td class="diffstat-total" align="right">1</td>
+ <td class="diffstat-graph">
+ <span class="diffstat-add" style="width:100.0%;"> </span>
+ <span class="diffstat-remove" style="width:0.0%;"> </span>
+ </td>
+ </tr>
+ <tr class="parity1">
+ <td class="diffstat-file"><a href="#l2.1">foo</a></td>
+ <td class="diffstat-total" align="right">1</td>
+ <td class="diffstat-graph">
+ <span class="diffstat-add" style="width:100.0%;"> </span>
+ <span class="diffstat-remove" style="width:0.0%;"> </span>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
<div class="overflow">
--- a/tests/test-hgweb-diffs.t Sat Jun 11 21:11:43 2011 +0800
+++ b/tests/test-hgweb-diffs.t Sat Jun 11 21:24:50 2011 +0800
@@ -94,6 +94,35 @@
<th class="files">files</th>
<td class="files"><a href="/file/0cd96de13884/a">a</a> <a href="/file/0cd96de13884/b">b</a> </td>
</tr>
+ <tr>
+ <th class="diffstat">diffstat</th>
+ <td class="diffstat">
+ 2 files changed, 2 insertions(+), 0 deletions(-)
+
+ <a id="diffstatexpand" href="javascript:showDiffstat()"/>[+]</a>
+ <div id="diffstatdetails" style="display:none;">
+ <a href="javascript:hideDiffstat()"/>[-]</a>
+ <p>
+ <table> <tr class="parity0">
+ <td class="diffstat-file"><a href="#l1.1">a</a></td>
+ <td class="diffstat-total" align="right">1</td>
+ <td class="diffstat-graph">
+ <span class="diffstat-add" style="width:100.0%;"> </span>
+ <span class="diffstat-remove" style="width:0.0%;"> </span>
+ </td>
+ </tr>
+ <tr class="parity1">
+ <td class="diffstat-file"><a href="#l2.1">b</a></td>
+ <td class="diffstat-total" align="right">1</td>
+ <td class="diffstat-graph">
+ <span class="diffstat-add" style="width:100.0%;"> </span>
+ <span class="diffstat-remove" style="width:0.0%;"> </span>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
<div class="overflow">
@@ -325,6 +354,35 @@
<th class="files">files</th>
<td class="files"><a href="/file/0cd96de13884/a">a</a> <a href="/file/0cd96de13884/b">b</a> </td>
</tr>
+ <tr>
+ <th class="diffstat">diffstat</th>
+ <td class="diffstat">
+ 2 files changed, 2 insertions(+), 0 deletions(-)
+
+ <a id="diffstatexpand" href="javascript:showDiffstat()"/>[+]</a>
+ <div id="diffstatdetails" style="display:none;">
+ <a href="javascript:hideDiffstat()"/>[-]</a>
+ <p>
+ <table> <tr class="parity0">
+ <td class="diffstat-file"><a href="#l1.1">a</a></td>
+ <td class="diffstat-total" align="right">1</td>
+ <td class="diffstat-graph">
+ <span class="diffstat-add" style="width:100.0%;"> </span>
+ <span class="diffstat-remove" style="width:0.0%;"> </span>
+ </td>
+ </tr>
+ <tr class="parity1">
+ <td class="diffstat-file"><a href="#l2.1">b</a></td>
+ <td class="diffstat-total" align="right">1</td>
+ <td class="diffstat-graph">
+ <span class="diffstat-add" style="width:100.0%;"> </span>
+ <span class="diffstat-remove" style="width:0.0%;"> </span>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
<div class="overflow">
--- a/tests/test-hgweb-removed.t Sat Jun 11 21:11:43 2011 +0800
+++ b/tests/test-hgweb-removed.t Sat Jun 11 21:24:50 2011 +0800
@@ -89,6 +89,27 @@
<th class="files">files</th>
<td class="files">a </td>
</tr>
+ <tr>
+ <th class="diffstat">diffstat</th>
+ <td class="diffstat">
+ 1 files changed, 0 insertions(+), 1 deletions(-)
+
+ <a id="diffstatexpand" href="javascript:showDiffstat()"/>[+]</a>
+ <div id="diffstatdetails" style="display:none;">
+ <a href="javascript:hideDiffstat()"/>[-]</a>
+ <p>
+ <table> <tr class="parity0">
+ <td class="diffstat-file"><a href="#l1.1">a</a></td>
+ <td class="diffstat-total" align="right">1</td>
+ <td class="diffstat-graph">
+ <span class="diffstat-add" style="width:0.0%;"> </span>
+ <span class="diffstat-remove" style="width:100.0%;"> </span>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
<div class="overflow">