hgweb: add links to diff and changeset in hover-box on annotate view
authorDenis Laxalde <denis.laxalde@logilab.fr>
Tue, 14 Jun 2016 11:01:30 +0200
changeset 29523 4b6afd1b445a
parent 29522 9c37df347485
child 29524 19f96077c61b
hgweb: add links to diff and changeset in hover-box on annotate view
mercurial/templates/gitweb/map
mercurial/templates/monoblue/map
mercurial/templates/paper/map
mercurial/templates/spartan/map
tests/test-hgweb-symrev.t
tests/test-highlight.t
--- a/mercurial/templates/gitweb/map	Tue Jun 28 11:42:42 2016 +0200
+++ b/mercurial/templates/gitweb/map	Tue Jun 14 11:01:30 2016 +0200
@@ -104,6 +104,8 @@
       <div class="annotate-info">
         <div>{node|short}: {desc|escape|firstline}</div>
         <div>parents: {parents%annotateparent}</div>
+        <a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a>
+        <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a>
       </div>
     </td>
     <td><pre><a class="linenr" href="#{lineid}">{linenumber}</a></pre></td>
--- a/mercurial/templates/monoblue/map	Tue Jun 28 11:42:42 2016 +0200
+++ b/mercurial/templates/monoblue/map	Tue Jun 14 11:01:30 2016 +0200
@@ -100,6 +100,8 @@
       <div class="annotate-info">
         <div>{node|short}: {desc|escape|firstline}</div>
         <div>parents: {parents%annotateparent}</div>
+        <a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a>
+        <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a>
       </div>
     </td>
     <td class="lineno">
--- a/mercurial/templates/paper/map	Tue Jun 28 11:42:42 2016 +0200
+++ b/mercurial/templates/paper/map	Tue Jun 14 11:01:30 2016 +0200
@@ -85,6 +85,8 @@
       <div class="annotate-info">
         <div>{node|short}: {desc|escape|firstline}</div>
         <div>parents: {parents%annotateparent}</div>
+        <a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a>
+        <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a>
       </div>
     </td>
     <td class="source"><a href="#{lineid}">{linenumber}</a> {line|escape}</td>
--- a/mercurial/templates/spartan/map	Tue Jun 28 11:42:42 2016 +0200
+++ b/mercurial/templates/spartan/map	Tue Jun 14 11:01:30 2016 +0200
@@ -63,6 +63,8 @@
       <div class="annotate-info">
         <div>{node|short}: {desc|escape|firstline}</div>
         <div>parents: {parents%annotateparent}</div>
+        <a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a>
+        <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a>
       </div>
     </td>
     <td>
--- a/tests/test-hgweb-symrev.t	Tue Jun 28 11:42:42 2016 +0200
+++ b/tests/test-hgweb-symrev.t	Tue Jun 14 11:01:30 2016 +0200
@@ -191,8 +191,12 @@
    <td class="author"><a href="/file/43c799df6e75/foo?style=paper">43c799df6e75</a> </td>
    <td class="author"><a href="/file/9d8c40cba617/foo?style=paper">9d8c40cba617</a> </td>
   <a href="/annotate/43c799df6e75/foo?style=paper#l1">
+  <a href="/diff/43c799df6e75/foo?style=paper">diff</a>
+  <a href="/rev/43c799df6e75?style=paper">changeset</a>
   <a href="/annotate/a7c1559b7bba/foo?style=paper#l2">
   <a href="/annotate/43c799df6e75/foo?style=paper">0</a></div>
+  <a href="/diff/a7c1559b7bba/foo?style=paper">diff</a>
+  <a href="/rev/a7c1559b7bba?style=paper">changeset</a>
 
   $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'diff/xyzzy/foo?style=paper' | egrep $REVLINKS
   <li><a href="/shortlog/xyzzy?style=paper">log</a></li>
@@ -380,8 +384,12 @@
    <td class="author"><a href="/file/43c799df6e75/foo?style=coal">43c799df6e75</a> </td>
    <td class="author"><a href="/file/9d8c40cba617/foo?style=coal">9d8c40cba617</a> </td>
   <a href="/annotate/43c799df6e75/foo?style=coal#l1">
+  <a href="/diff/43c799df6e75/foo?style=coal">diff</a>
+  <a href="/rev/43c799df6e75?style=coal">changeset</a>
   <a href="/annotate/a7c1559b7bba/foo?style=coal#l2">
   <a href="/annotate/43c799df6e75/foo?style=coal">0</a></div>
+  <a href="/diff/a7c1559b7bba/foo?style=coal">diff</a>
+  <a href="/rev/a7c1559b7bba?style=coal">changeset</a>
 
   $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'diff/xyzzy/foo?style=coal' | egrep $REVLINKS
   <li><a href="/shortlog/xyzzy?style=coal">log</a></li>
@@ -619,8 +627,12 @@
   <a class="list" href="/annotate/43c799df6e75/foo?style=gitweb">
   <a class="list" href="/annotate/9d8c40cba617/foo?style=gitweb">9d8c40cba617</a></td>
   <a href="/annotate/43c799df6e75/foo?style=gitweb#l1">
+  <a href="/diff/43c799df6e75/foo?style=gitweb">diff</a>
+  <a href="/rev/43c799df6e75?style=gitweb">changeset</a>
   <a href="/annotate/a7c1559b7bba/foo?style=gitweb#l2">
   <a href="/annotate/43c799df6e75/foo?style=gitweb">0</a></div>
+  <a href="/diff/a7c1559b7bba/foo?style=gitweb">diff</a>
+  <a href="/rev/a7c1559b7bba?style=gitweb">changeset</a>
 
   $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'diff/xyzzy/foo?style=gitweb' | egrep $REVLINKS
   <a href="/file/xyzzy?style=gitweb">files</a> |
@@ -836,8 +848,12 @@
   <a href="/annotate/43c799df6e75/foo?style=monoblue">
   <a href="/annotate/9d8c40cba617/foo?style=monoblue">9d8c40cba617</a>
   <a href="/annotate/43c799df6e75/foo?style=monoblue#l1">
+  <a href="/diff/43c799df6e75/foo?style=monoblue">diff</a>
+  <a href="/rev/43c799df6e75?style=monoblue">changeset</a>
   <a href="/annotate/a7c1559b7bba/foo?style=monoblue#l2">
   <a href="/annotate/43c799df6e75/foo?style=monoblue">0</a></div>
+  <a href="/diff/a7c1559b7bba/foo?style=monoblue">diff</a>
+  <a href="/rev/a7c1559b7bba?style=monoblue">changeset</a>
 
   $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'diff/xyzzy/foo?style=monoblue' | egrep $REVLINKS
               <li><a href="/graph/xyzzy?style=monoblue">graph</a></li>
@@ -1034,8 +1050,12 @@
   <a href="/annotate/43c799df6e75/foo?style=spartan">
   <td><a href="/annotate/9d8c40cba617/foo?style=spartan">9d8c40cba617</a></td>
   <a href="/annotate/43c799df6e75/foo?style=spartan#l1">
+  <a href="/diff/43c799df6e75/foo?style=spartan">diff</a>
+  <a href="/rev/43c799df6e75?style=spartan">changeset</a>
   <a href="/annotate/a7c1559b7bba/foo?style=spartan#l2">
   <a href="/annotate/43c799df6e75/foo?style=spartan">0</a></div>
+  <a href="/diff/a7c1559b7bba/foo?style=spartan">diff</a>
+  <a href="/rev/a7c1559b7bba?style=spartan">changeset</a>
 
   $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'diff/xyzzy/foo?style=spartan' | egrep $REVLINKS
   <a href="/log/xyzzy?style=spartan">changelog</a>
--- a/tests/test-highlight.t	Tue Jun 28 11:42:42 2016 +0200
+++ b/tests/test-highlight.t	Tue Jun 14 11:01:30 2016 +0200
@@ -296,6 +296,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l1">     1</a> <span class="c">#!/usr/bin/env python</span></td>
@@ -306,6 +308,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l2">     2</a> </td>
@@ -316,6 +320,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l3">     3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></td>
@@ -326,6 +332,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l4">     4</a> </td>
@@ -336,6 +344,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l5">     5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td>
@@ -346,6 +356,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l6">     6</a> <span class="sd">    where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></td>
@@ -356,6 +368,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l7">     7</a> <span class="sd">&quot;&quot;&quot;</span></td>
@@ -366,6 +380,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l8">     8</a> </td>
@@ -376,6 +392,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l9">     9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td>
@@ -386,6 +404,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l10">    10</a> </td>
@@ -396,6 +416,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l11">    11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td>
@@ -406,6 +428,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l12">    12</a>     <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></td>
@@ -416,6 +440,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l13">    13</a>     <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
@@ -426,6 +452,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l14">    14</a>         <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td>
@@ -436,6 +464,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l15">    15</a>         <span class="c"># It is important to yield *here* in order to stop the</span></td>
@@ -446,6 +476,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l16">    16</a>         <span class="c"># infinite recursion.</span></td>
@@ -456,6 +488,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l17">    17</a>         <span class="kn">yield</span> <span class="n">p</span></td>
@@ -466,6 +500,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l18">    18</a>         <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td>
@@ -476,6 +512,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l19">    19</a>         <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
@@ -486,6 +524,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l20">    20</a>             <span class="kn">yield</span> <span class="n">n</span></td>
@@ -496,6 +536,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l21">    21</a> </td>
@@ -506,6 +548,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l22">    22</a>     <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td>
@@ -516,6 +560,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l23">    23</a>     <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></td>
@@ -526,6 +572,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l24">    24</a> </td>
@@ -536,6 +584,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l25">    25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></td>
@@ -546,6 +596,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l26">    26</a>     <span class="kn">import</span> <span class="nn">sys</span></td>
@@ -556,6 +608,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l27">    27</a>     <span class="kn">try</span><span class="p">:</span></td>
@@ -566,6 +620,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l28">    28</a>         <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></td>
@@ -576,6 +632,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l29">    29</a>     <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td>
@@ -586,6 +644,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l30">    30</a>         <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></td>
@@ -596,6 +656,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l31">    31</a>     <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td>
@@ -606,6 +668,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l32">    32</a>     <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td>
@@ -616,6 +680,8 @@
   <div class="annotate-info">
   <div>06824edf55d0: a</div>
   <div>parents: </div>
+  <a href="/diff/06824edf55d0/primes.py">diff</a>
+  <a href="/rev/06824edf55d0">changeset</a>
   </div>
   </td>
   <td class="source"><a href="#l33">    33</a> </td>