[PATCH 3 of 6] paper: render changesets server-side on /graph page
Anton Shestakov
av6 at dwimlabs.net
Mon Dec 4 07:40:40 EST 2017
# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1512375675 -28800
# Mon Dec 04 16:21:15 2017 +0800
# Node ID 01869367acccffd4d80d49de578a322b6a370553
# Parent c75e3f9f9b321cb5f7e048302aee3163df46cbc3
# EXP-Topic hgweb-more-info
paper: render changesets server-side on /graph page
diff --git a/contrib/wix/templates.wxs b/contrib/wix/templates.wxs
--- a/contrib/wix/templates.wxs
+++ b/contrib/wix/templates.wxs
@@ -143,6 +143,7 @@
<File Id="paper.filerevision.tmpl" Name="filerevision.tmpl" />
<File Id="paper.footer.tmpl" Name="footer.tmpl" />
<File Id="paper.graph.tmpl" Name="graph.tmpl" />
+ <File Id="paper.graphentry.tmpl" Name="graphentry.tmpl" />
<File Id="paper.header.tmpl" Name="header.tmpl" />
<File Id="paper.index.tmpl" Name="index.tmpl" />
<File Id="paper.manifest.tmpl" Name="manifest.tmpl" />
diff --git a/mercurial/templates/paper/graph.tmpl b/mercurial/templates/paper/graph.tmpl
--- a/mercurial/templates/paper/graph.tmpl
+++ b/mercurial/templates/paper/graph.tmpl
@@ -52,7 +52,7 @@
<div id="wrapper">
<ul id="nodebgs" class="stripes2"></ul>
<canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
-<ul id="graphnodes"></ul>
+<ul id="graphnodes">{nodes%graphentry}</ul>
</div>
<script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>
@@ -71,38 +71,13 @@ graph.vertex = function(x, y, radius, co
var bg = '<li class="bg"></li>';
var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
- var nstyle = 'padding-left: ' + left + 'px;';
- var tagspan = '';
- if (cur[7].length || cur[8].length || (cur[6][0] != 'default' || cur[6][1])) \{
- tagspan = '<span class="logtags">';
- if (cur[6][1]) \{
- tagspan += '<span class="branchhead" title="' + cur[6][0] + '">';
- tagspan += cur[6][0] + '</span> ';
- } else if (!cur[6][1] && cur[6][0] != 'default') \{
- tagspan += '<span class="branchname" title="' + cur[6][0] + '">';
- tagspan += cur[6][0] + '</span> ';
- }
- if (cur[7].length) \{
- for (var t in cur[7]) \{
- var tag = cur[7][t];
- tagspan += '<span class="tag">' + tag + '</span> ';
- }
- }
- if (cur[8].length) \{
- for (var b in cur[8]) \{
- var bookmark = cur[8][b];
- tagspan += '<span class="tag">' + bookmark + '</span> ';
- }
- }
- tagspan += '</span>';
+ var item = document.querySelector('[data-node="' + cur.node + '"]');
+ if (item) \{
+ item.style.paddingLeft = left + 'px';
}
-
- var item = '<li style="' + nstyle + '"><span class="desc">';
- item += '<a href="{url|urlescape}rev/' + cur[0] + '{sessionvars%urlparameter}" title="' + cur[0] + '">' + cur[3] + '</a>';
- item += '</span>' + tagspan + '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
- return [bg, item];
+ return [bg, ''];
}
diff --git a/mercurial/templates/paper/graphentry.tmpl b/mercurial/templates/paper/graphentry.tmpl
new file mode 100644
--- /dev/null
+++ b/mercurial/templates/paper/graphentry.tmpl
@@ -0,0 +1,7 @@
+<li data-node="{node|short}">
+ <span class="desc">
+ <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a>
+ </span>
+ {alltags}
+ <span class="info"><span class="age">{date|rfc822date}</span>, by {author|person}</span>
+</li>
diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map
--- a/mercurial/templates/paper/map
+++ b/mercurial/templates/paper/map
@@ -9,6 +9,7 @@ changelog = shortlog.tmpl
shortlog = shortlog.tmpl
shortlogentry = shortlogentry.tmpl
graph = graph.tmpl
+graphentry = graphentry.tmpl
help = help.tmpl
helptopics = helptopics.tmpl
diff --git a/tests/test-hgweb-empty.t b/tests/test-hgweb-empty.t
--- a/tests/test-hgweb-empty.t
+++ b/tests/test-hgweb-empty.t
@@ -315,38 +315,13 @@ Some tests for hgweb in an empty reposit
var bg = '<li class="bg"></li>';
var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
- var nstyle = 'padding-left: ' + left + 'px;';
- var tagspan = '';
- if (cur[7].length || cur[8].length || (cur[6][0] != 'default' || cur[6][1])) {
- tagspan = '<span class="logtags">';
- if (cur[6][1]) {
- tagspan += '<span class="branchhead" title="' + cur[6][0] + '">';
- tagspan += cur[6][0] + '</span> ';
- } else if (!cur[6][1] && cur[6][0] != 'default') {
- tagspan += '<span class="branchname" title="' + cur[6][0] + '">';
- tagspan += cur[6][0] + '</span> ';
- }
- if (cur[7].length) {
- for (var t in cur[7]) {
- var tag = cur[7][t];
- tagspan += '<span class="tag">' + tag + '</span> ';
- }
- }
- if (cur[8].length) {
- for (var b in cur[8]) {
- var bookmark = cur[8][b];
- tagspan += '<span class="tag">' + bookmark + '</span> ';
- }
- }
- tagspan += '</span>';
+ var item = document.querySelector('[data-node="' + cur.node + '"]');
+ if (item) {
+ item.style.paddingLeft = left + 'px';
}
-
- var item = '<li style="' + nstyle + '"><span class="desc">';
- item += '<a href="/rev/' + cur[0] + '" title="' + cur[0] + '">' + cur[3] + '</a>';
- item += '</span>' + tagspan + '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
- return [bg, item];
+ return [bg, ''];
}
diff --git a/tests/test-hgweb-symrev.t b/tests/test-hgweb-symrev.t
--- a/tests/test-hgweb-symrev.t
+++ b/tests/test-hgweb-symrev.t
@@ -59,6 +59,9 @@ Set up the repo
<a href="/graph/tip?revcount=30&style=paper">less</a>
<a href="/graph/tip?revcount=120&style=paper">more</a>
| rev 2: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a>
+ <a href="/rev/9d8c40cba617?style=paper">third</a>
+ <a href="/rev/a7c1559b7bba?style=paper">second</a>
+ <a href="/rev/43c799df6e75?style=paper">first</a>
<a href="/graph/tip?revcount=30&style=paper">less</a>
<a href="/graph/tip?revcount=120&style=paper">more</a>
| rev 2: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a>
@@ -123,6 +126,8 @@ Set up the repo
<a href="/graph/xyzzy?revcount=30&style=paper">less</a>
<a href="/graph/xyzzy?revcount=120&style=paper">more</a>
| rev 1: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a>
+ <a href="/rev/a7c1559b7bba?style=paper">second</a>
+ <a href="/rev/43c799df6e75?style=paper">first</a>
<a href="/graph/xyzzy?revcount=30&style=paper">less</a>
<a href="/graph/xyzzy?revcount=120&style=paper">more</a>
| rev 1: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a>
@@ -254,6 +259,9 @@ Set up the repo
<a href="/graph/tip?revcount=30&style=coal">less</a>
<a href="/graph/tip?revcount=120&style=coal">more</a>
| rev 2: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a>
+ <a href="/rev/9d8c40cba617?style=coal">third</a>
+ <a href="/rev/a7c1559b7bba?style=coal">second</a>
+ <a href="/rev/43c799df6e75?style=coal">first</a>
<a href="/graph/tip?revcount=30&style=coal">less</a>
<a href="/graph/tip?revcount=120&style=coal">more</a>
| rev 2: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a>
@@ -318,6 +326,8 @@ Set up the repo
<a href="/graph/xyzzy?revcount=30&style=coal">less</a>
<a href="/graph/xyzzy?revcount=120&style=coal">more</a>
| rev 1: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a>
+ <a href="/rev/a7c1559b7bba?style=coal">second</a>
+ <a href="/rev/43c799df6e75?style=coal">first</a>
<a href="/graph/xyzzy?revcount=30&style=coal">less</a>
<a href="/graph/xyzzy?revcount=120&style=coal">more</a>
| rev 1: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a>
More information about the Mercurial-devel
mailing list