[PATCH 3 of 4] paper, coal: define the diffstat templates

Steven Brown stevengbrown at gmail.com
Wed Jun 8 17:38:08 UTC 2011


# HG changeset patch
# User Steven Brown <StevenGBrown at gmail.com>
# Date 1307553579 -28800
# Node ID deee7d56bb80b73b7b22b692d66132be36bd9bab
# Parent  202c192a657a06befea8311c4cd04bb10f6c2463
paper, coal: define the diffstat templates

The templates output the filename, the total number of changes to the file
and a bar graph of the adds and removes. The filename is a link into the diff
output.

The diffstat is not yet displayed, but it can be manually added to the
changeset page template.

diff --git a/mercurial/templates/coal/map b/mercurial/templates/coal/map
--- a/mercurial/templates/coal/map
+++ b/mercurial/templates/coal/map
@@ -23,6 +23,8 @@
 filenodelink = '<a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{file|escape}</a> '
 filenolink = '{file|escape} '
 fileellipses = '...'
+diffstatlink = ../paper/diffstat.tmpl
+diffstatnolink = ../paper/diffstat.tmpl
 changelogentry = ../paper/shortlogentry.tmpl
 searchentry = ../paper/shortlogentry.tmpl
 changeset = ../paper/changeset.tmpl
diff --git a/mercurial/templates/paper/diffstat.tmpl b/mercurial/templates/paper/diffstat.tmpl
new file mode 100644
--- /dev/null
+++ b/mercurial/templates/paper/diffstat.tmpl
@@ -0,0 +1,8 @@
+  <tr class="parity{parity}">
+    <td class="diffstat-file"><a href="#l{fileno}.1">{file|escape}</a></td>
+    <td class="diffstat-total" align="right">{total}</td>
+    <td class="diffstat-graph">
+      <span class="diffstat-add" style="width:{addpct}%;"> </span>
+      <span class="diffstat-remove" style="width:{removepct}%;"> </span>
+    </td>
+  </tr>
diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map
--- a/mercurial/templates/paper/map
+++ b/mercurial/templates/paper/map
@@ -22,6 +22,8 @@
 filenodelink = '<a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{file|escape}</a> '
 filenolink = '{file|escape} '
 fileellipses = '...'
+diffstatlink = diffstat.tmpl
+diffstatnolink = diffstat.tmpl
 changelogentry = shortlogentry.tmpl
 searchentry = shortlogentry.tmpl
 changeset = changeset.tmpl
diff --git a/mercurial/templates/static/style-coal.css b/mercurial/templates/static/style-coal.css
--- a/mercurial/templates/static/style-coal.css
+++ b/mercurial/templates/static/style-coal.css
@@ -103,6 +103,26 @@
 .minusline { color: #dc143c; } /* crimson */
 .atline { color: purple; }
 
+.diffstat-file {
+  white-space: nowrap;
+  font-size: 90%;
+}
+.diffstat-total {
+  white-space: nowrap;
+  font-size: 90%;
+}
+.diffstat-graph {
+  width: 100%;
+}
+.diffstat-add {
+  background-color: green;
+  float: left;
+}
+.diffstat-remove {
+  background-color: red;
+  float: left;
+}
+
 .navigate {
   text-align: right;
   font-size: 60%;
diff --git a/mercurial/templates/static/style-paper.css b/mercurial/templates/static/style-paper.css
--- a/mercurial/templates/static/style-paper.css
+++ b/mercurial/templates/static/style-paper.css
@@ -94,6 +94,26 @@
 .minusline { color: #dc143c; } /* crimson */
 .atline { color: purple; }
 
+.diffstat-file {
+  white-space: nowrap;
+  font-size: 90%;
+}
+.diffstat-total {
+  white-space: nowrap;
+  font-size: 90%;
+}
+.diffstat-graph {
+  width: 100%;
+}
+.diffstat-add {
+  background-color: green;
+  float: left;
+}
+.diffstat-remove {
+  background-color: red;
+  float: left;
+}
+
 .navigate {
   text-align: right;
   font-size: 60%;



More information about the Mercurial-devel mailing list