gitweb: render changesets server-side on /graph page

This commit is contained in:
Anton Shestakov 2017-12-04 17:43:45 +08:00
parent 3c2de0ad20
commit 55006fdcc2
6 changed files with 52 additions and 62 deletions

View File

@ -85,6 +85,7 @@
<File Id="gitweb.filerevision.tmpl" Name="filerevision.tmpl" />
<File Id="gitweb.footer.tmpl" Name="footer.tmpl" />
<File Id="gitweb.graph.tmpl" Name="graph.tmpl" />
<File Id="gitweb.graphentry.tmpl" Name="graphentry.tmpl" />
<File Id="gitweb.header.tmpl" Name="header.tmpl" />
<File Id="gitweb.index.tmpl" Name="index.tmpl" />
<File Id="gitweb.manifest.tmpl" Name="manifest.tmpl" />

View File

@ -39,7 +39,7 @@ graph |
<div id="wrapper">
<ul id="nodebgs"></ul>
<canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
<ul id="graphnodes"></ul>
<ul id="graphnodes">{nodes%graphentry}</ul>
</div>
<script{if(nonce, ' nonce="{nonce}"')}>
@ -58,39 +58,13 @@ graph.vertex = function(x, y, radius, color, parity, cur) \{
var bg = '<li class="bg parity' + parity + '"></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="branchtag" title="' + cur[6][0] + '">';
tagspan += cur[6][0] + '</span> ';
} else if (!cur[6][1] && cur[6][0] != 'default') \{
tagspan += '<span class="inbranchtag" 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="tagtag">' + tag + '</span> ';
}
}
if (cur[8].length) \{
for (var t in cur[8]) \{
var bookmark = cur[8][t];
tagspan += '<span class="bookmarktag">' + 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 class="list" href="{url|urlescape}rev/' + cur[0] + '{sessionvars%urlparameter}" title="' + cur[0] + '"><b>' + cur[3] + '</b></a>';
item += '</span> ' + tagspan + '';
item += '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
return [bg, item];
return [bg, ''];
}

View File

@ -0,0 +1,7 @@
<li data-node="{node|short}">
<span class="desc">
<a class="list" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}"><b>{desc|strip|firstline|escape|nonempty}</b></a>
</span>
{alltags}
<span class="info">{date|age}, by {author|person}</span>
</li>

View File

@ -262,6 +262,7 @@ filecompchild = '
</tr>'
shortlog = shortlog.tmpl
graph = graph.tmpl
graphentry = graphentry.tmpl
phasetag = '{ifeq(phase, 'public', '', '<span class="phasetag" title="{phase|escape}">{phase|escape}</span> ')}'
obsoletetag = '{if(obsolete, '<span class="obsoletetag" title="obsolete">obsolete</span> ')}'
instabilitytag = '<span class="instabilitytag" title="{instability|escape}">{instability|escape}</span> '

View File

@ -1782,7 +1782,35 @@ Overviews
<div id="wrapper">
<ul id="nodebgs"></ul>
<canvas id="graph" width="39" height="168"></canvas>
<ul id="graphnodes"></ul>
<ul id="graphnodes"><li data-node="cad8025a2e87">
<span class="desc">
<a class="list" href="/rev/cad8025a2e87?style=gitweb"><b>branch commit with null character: </b></a>
</span>
<span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="unstable">unstable</span> <span class="tagtag" title="tip">tip</span> <span class="bookmarktag" title="something">something</span> </span>
<span class="info">1970-01-01, by test</span>
</li>
<li data-node="1d22e65f027e">
<span class="desc">
<a class="list" href="/rev/1d22e65f027e?style=gitweb"><b>branch</b></a>
</span>
<span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="stable">stable</span> </span>
<span class="info">1970-01-01, by test</span>
</li>
<li data-node="a4f92ed23982">
<span class="desc">
<a class="list" href="/rev/a4f92ed23982?style=gitweb"><b>Added tag 1.0 for changeset 2ef0ac749a14</b></a>
</span>
<span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="default">default</span> </span>
<span class="info">1970-01-01, by test</span>
</li>
<li data-node="2ef0ac749a14">
<span class="desc">
<a class="list" href="/rev/2ef0ac749a14?style=gitweb"><b>base</b></a>
</span>
<span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="tagtag" title="1.0">1.0</span> <span class="bookmarktag" title="anotherthing">anotherthing</span> </span>
<span class="info">1970-01-01, by test</span>
</li>
</ul>
</div>
<script>
@ -1801,39 +1829,13 @@ Overviews
var bg = '<li class="bg parity' + parity + '"></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="branchtag" title="' + cur[6][0] + '">';
tagspan += cur[6][0] + '</span> ';
} else if (!cur[6][1] && cur[6][0] != 'default') {
tagspan += '<span class="inbranchtag" 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="tagtag">' + tag + '</span> ';
}
}
if (cur[8].length) {
for (var t in cur[8]) {
var bookmark = cur[8][t];
tagspan += '<span class="bookmarktag">' + 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 class="list" href="/rev/' + cur[0] + '?style=gitweb" title="' + cur[0] + '"><b>' + cur[3] + '</b></a>';
item += '</span> ' + tagspan + '';
item += '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
return [bg, item];
return [bg, ''];
}

View File

@ -493,6 +493,9 @@ Set up the repo
<a href="/graph/tip?revcount=30&style=gitweb">less</a>
<a href="/graph/tip?revcount=120&style=gitweb">more</a>
| <a href="/graph/43c799df6e75?style=gitweb">(0)</a> <a href="/graph/tip?style=gitweb">tip</a>
<a class="list" href="/rev/9d8c40cba617?style=gitweb"><b>third</b></a>
<a class="list" href="/rev/a7c1559b7bba?style=gitweb"><b>second</b></a>
<a class="list" href="/rev/43c799df6e75?style=gitweb"><b>first</b></a>
<a href="/graph/tip?revcount=30&style=gitweb">less</a>
<a href="/graph/tip?revcount=120&style=gitweb">more</a>
| <a href="/graph/43c799df6e75?style=gitweb">(0)</a> <a href="/graph/tip?style=gitweb">tip</a>
@ -583,6 +586,8 @@ Set up the repo
<a href="/graph/xyzzy?revcount=30&style=gitweb">less</a>
<a href="/graph/xyzzy?revcount=120&style=gitweb">more</a>
| <a href="/graph/43c799df6e75?style=gitweb">(0)</a> <a href="/graph/tip?style=gitweb">tip</a>
<a class="list" href="/rev/a7c1559b7bba?style=gitweb"><b>second</b></a>
<a class="list" href="/rev/43c799df6e75?style=gitweb"><b>first</b></a>
<a href="/graph/xyzzy?revcount=30&style=gitweb">less</a>
<a href="/graph/xyzzy?revcount=120&style=gitweb">more</a>
| <a href="/graph/43c799df6e75?style=gitweb">(0)</a> <a href="/graph/tip?style=gitweb">tip</a>