changeset 35230:75f9f366e5cc

monoblue: render changesets server-side on /graph page
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 04 Dec 2017 18:26:54 +0800
parents dc623009e0b0
children 66c11a66ad1a
files contrib/wix/templates.wxs mercurial/templates/monoblue/graph.tmpl mercurial/templates/monoblue/graphentry.tmpl mercurial/templates/monoblue/map tests/test-hgweb-symrev.t
diffstat 5 files changed, 19 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/wix/templates.wxs	Mon Dec 04 17:43:45 2017 +0800
+++ b/contrib/wix/templates.wxs	Mon Dec 04 18:26:54 2017 +0800
@@ -115,6 +115,7 @@
             <File Id="monoblue.filerevision.tmpl"   Name="filerevision.tmpl" />
             <File Id="monoblue.footer.tmpl"         Name="footer.tmpl" />
             <File Id="monoblue.graph.tmpl"          Name="graph.tmpl" />
+            <File Id="monoblue.graphentry.tmpl"     Name="graphentry.tmpl" />
             <File Id="monoblue.header.tmpl"         Name="header.tmpl" />
             <File Id="monoblue.index.tmpl"          Name="index.tmpl" />
             <File Id="monoblue.manifest.tmpl"       Name="manifest.tmpl" />
--- a/mercurial/templates/monoblue/graph.tmpl	Mon Dec 04 17:43:45 2017 +0800
+++ b/mercurial/templates/monoblue/graph.tmpl	Mon Dec 04 18:26:54 2017 +0800
@@ -31,7 +31,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{if(nonce, ' nonce="{nonce}"')}>
@@ -52,38 +52,13 @@
 
         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 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, ''];
 
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/templates/monoblue/graphentry.tmpl	Mon Dec 04 18:26:54 2017 +0800
@@ -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>
--- a/mercurial/templates/monoblue/map	Mon Dec 04 17:43:45 2017 +0800
+++ b/mercurial/templates/monoblue/map	Mon Dec 04 18:26:54 2017 +0800
@@ -282,6 +282,7 @@
 urlparameter = '{separator}{name}={value|urlescape}'
 hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />'
 graph = graph.tmpl
+graphentry = graphentry.tmpl
 breadcrumb = '&gt; <a href="{url|urlescape}">{name|escape}</a> '
 
 searchform = '
--- a/tests/test-hgweb-symrev.t	Mon Dec 04 17:43:45 2017 +0800
+++ b/tests/test-hgweb-symrev.t	Mon Dec 04 18:26:54 2017 +0800
@@ -731,6 +731,9 @@
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'graph?style=monoblue' | egrep $REVLINKS
               <li><a href="/file/tip?style=monoblue">files</a></li>
+          <a href="/rev/9d8c40cba617?style=monoblue">third</a>
+          <a href="/rev/a7c1559b7bba?style=monoblue">second</a>
+          <a href="/rev/43c799df6e75?style=monoblue">first</a>
           <a href="/graph/tip?revcount=30&style=monoblue">less</a>
           <a href="/graph/tip?revcount=120&style=monoblue">more</a>
           | <a href="/graph/43c799df6e75?style=monoblue">(0)</a> <a href="/graph/tip?style=monoblue">tip</a> 
@@ -810,6 +813,8 @@
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'graph/xyzzy?style=monoblue' | egrep $REVLINKS
               <li><a href="/file/xyzzy?style=monoblue">files</a></li>
+          <a href="/rev/a7c1559b7bba?style=monoblue">second</a>
+          <a href="/rev/43c799df6e75?style=monoblue">first</a>
           <a href="/graph/xyzzy?revcount=30&style=monoblue">less</a>
           <a href="/graph/xyzzy?revcount=120&style=monoblue">more</a>
           | <a href="/graph/43c799df6e75?style=monoblue">(0)</a> <a href="/graph/tip?style=monoblue">tip</a>