[PATCH 6 of 6] spartan: render changesets server-side on /graph page
Anton Shestakov
av6 at dwimlabs.net
Mon Dec 4 07:40:43 EST 2017
# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1512385721 -28800
# Mon Dec 04 19:08:41 2017 +0800
# Node ID aa14b97727c79991683a2ffd45986d18e3657576
# Parent c85a282fa36ff57c7491700c54a1af9c69ded03c
# EXP-Topic hgweb-more-info
spartan: 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
@@ -211,6 +211,7 @@
<File Id="spartan.filerevision.tmpl" Name="filerevision.tmpl" />
<File Id="spartan.footer.tmpl" Name="footer.tmpl" />
<File Id="spartan.graph.tmpl" Name="graph.tmpl" />
+ <File Id="spartan.graphentry.tmpl" Name="graphentry.tmpl" />
<File Id="spartan.header.tmpl" Name="header.tmpl" />
<File Id="spartan.index.tmpl" Name="index.tmpl" />
<File Id="spartan.manifest.tmpl" Name="manifest.tmpl" />
diff --git a/mercurial/templates/spartan/graph.tmpl b/mercurial/templates/spartan/graph.tmpl
--- a/mercurial/templates/spartan/graph.tmpl
+++ b/mercurial/templates/spartan/graph.tmpl
@@ -33,7 +33,7 @@ navigate: <small class="navigate">{chang
<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 type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>
@@ -52,12 +52,12 @@ graph.vertex = function(x, y, radius, co
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 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><span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
+ var item = document.querySelector('[data-node="' + cur.node + '"]');
+ if (item) \{
+ item.style.paddingLeft = left + 'px';
+ }
- return [bg, item];
+ return [bg, ''];
}
diff --git a/mercurial/templates/spartan/graphentry.tmpl b/mercurial/templates/spartan/graphentry.tmpl
new file mode 100644
--- /dev/null
+++ b/mercurial/templates/spartan/graphentry.tmpl
@@ -0,0 +1,6 @@
+<li data-node="{node|short}">
+ <span class="desc">
+ <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a>
+ </span>
+ <span class="info"><span class="age">{date|rfc822date}</span>, by {author|person}</span>
+</li>
diff --git a/mercurial/templates/spartan/map b/mercurial/templates/spartan/map
--- a/mercurial/templates/spartan/map
+++ b/mercurial/templates/spartan/map
@@ -7,6 +7,7 @@ changelog = changelog.tmpl
shortlog = shortlog.tmpl
shortlogentry = shortlogentry.tmpl
graph = graph.tmpl
+graphentry = graphentry.tmpl
naventry = '<a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
navshortentry = '<a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
navgraphentry = '<a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
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
@@ -946,6 +946,9 @@ Set up the repo
<a href="/shortlog/tip?style=spartan">shortlog</a>
<a href="/file/tip/?style=spartan">files</a>
navigate: <small class="navigate"><a href="/graph/43c799df6e75?style=spartan">(0)</a> <a href="/graph/tip?style=spartan">tip</a> </small>
+ <a href="/rev/9d8c40cba617?style=spartan">third</a>
+ <a href="/rev/a7c1559b7bba?style=spartan">second</a>
+ <a href="/rev/43c799df6e75?style=spartan">first</a>
navigate: <small class="navigate"><a href="/graph/43c799df6e75?style=spartan">(0)</a> <a href="/graph/tip?style=spartan">tip</a> </small>
$ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'tags?style=spartan' | egrep $REVLINKS
@@ -1023,6 +1026,8 @@ Set up the repo
<a href="/shortlog/xyzzy?style=spartan">shortlog</a>
<a href="/file/xyzzy/?style=spartan">files</a>
navigate: <small class="navigate"><a href="/graph/43c799df6e75?style=spartan">(0)</a> <a href="/graph/tip?style=spartan">tip</a> </small>
+ <a href="/rev/a7c1559b7bba?style=spartan">second</a>
+ <a href="/rev/43c799df6e75?style=spartan">first</a>
navigate: <small class="navigate"><a href="/graph/43c799df6e75?style=spartan">(0)</a> <a href="/graph/tip?style=spartan">tip</a> </small>
$ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'file/xyzzy?style=spartan' | egrep $REVLINKS
More information about the Mercurial-devel
mailing list