spartan: render changesets server-side on /graph page
authorAnton Shestakov <av6@dwimlabs.net>
Mon, 04 Dec 2017 19:08:41 +0800
changeset 35222 66c11a66ad1a
parent 35221 75f9f366e5cc
child 35223 4edd2202f7d7
spartan: render changesets server-side on /graph page
contrib/wix/templates.wxs
mercurial/templates/spartan/graph.tmpl
mercurial/templates/spartan/graphentry.tmpl
mercurial/templates/spartan/map
tests/test-hgweb-symrev.t
--- a/contrib/wix/templates.wxs	Mon Dec 04 18:26:54 2017 +0800
+++ b/contrib/wix/templates.wxs	Mon Dec 04 19:08:41 2017 +0800
@@ -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" />
--- a/mercurial/templates/spartan/graph.tmpl	Mon Dec 04 18:26:54 2017 +0800
+++ b/mercurial/templates/spartan/graph.tmpl	Mon Dec 04 19:08:41 2017 +0800
@@ -33,7 +33,7 @@
 <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 @@
 	
 	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, ''];
 	
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/templates/spartan/graphentry.tmpl	Mon Dec 04 19:08:41 2017 +0800
@@ -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>
--- a/mercurial/templates/spartan/map	Mon Dec 04 18:26:54 2017 +0800
+++ b/mercurial/templates/spartan/map	Mon Dec 04 19:08:41 2017 +0800
@@ -7,6 +7,7 @@
 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> '
--- a/tests/test-hgweb-symrev.t	Mon Dec 04 18:26:54 2017 +0800
+++ b/tests/test-hgweb-symrev.t	Mon Dec 04 19:08:41 2017 +0800
@@ -946,6 +946,9 @@
   <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 @@
   <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