Patchwork [5,of,6] monoblue: render changesets server-side on /graph page

login
register
mail settings
Submitter Anton Shestakov
Date Dec. 4, 2017, 12:40 p.m.
Message ID <c85a282fa36ff57c7491.1512391242@neuro>
Download mbox | patch
Permalink /patch/25920/
State Accepted
Headers show

Comments

Anton Shestakov - Dec. 4, 2017, 12:40 p.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1512383214 -28800
#      Mon Dec 04 18:26:54 2017 +0800
# Node ID c85a282fa36ff57c7491700c54a1af9c69ded03c
# Parent  a7a3300dd1e3270f57689c653a37f4a679c27bdf
# EXP-Topic hgweb-more-info
monoblue: render changesets server-side on /graph page

Patch

diff --git a/contrib/wix/templates.wxs b/contrib/wix/templates.wxs
--- a/contrib/wix/templates.wxs
+++ b/contrib/wix/templates.wxs
@@ -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" />
diff --git a/mercurial/templates/monoblue/graph.tmpl b/mercurial/templates/monoblue/graph.tmpl
--- a/mercurial/templates/monoblue/graph.tmpl
+++ b/mercurial/templates/monoblue/graph.tmpl
@@ -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, ''];
 
     }
 
diff --git a/mercurial/templates/monoblue/graphentry.tmpl b/mercurial/templates/monoblue/graphentry.tmpl
new file mode 100644
--- /dev/null
+++ b/mercurial/templates/monoblue/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/monoblue/map b/mercurial/templates/monoblue/map
--- a/mercurial/templates/monoblue/map
+++ b/mercurial/templates/monoblue/map
@@ -282,6 +282,7 @@  index = index.tmpl
 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 = '
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
@@ -731,6 +731,9 @@  Set up the repo
 
   $ "$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 @@  Set up the repo
 
   $ "$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>