Patchwork [3,of,3,V4] gitweb: add links to diff and changeset views from annotate view table

login
register
mail settings
Submitter Denis Laxalde
Date June 10, 2016, 2:09 p.m.
Message ID <00902f242ef6215280c9.1465567772@sh77.tls.logilab.fr>
Download mbox | patch
Permalink /patch/15460/
State Superseded
Headers show

Comments

Denis Laxalde - June 10, 2016, 2:09 p.m.
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1464883191 -7200
#      Thu Jun 02 17:59:51 2016 +0200
# Node ID 00902f242ef6215280c9e1e885e1b35146a74896
# Parent  ef36915eea1481660febffc16f84124c52fecbe8
gitweb: add links to diff and changeset views from annotate view table

Links only appear at head of a block of lines annotated by a given revision
(following the logic of previous patch "hgweb: display blamed revision once
per block in annotate view").

Patch

diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map
--- a/mercurial/templates/gitweb/map
+++ b/mercurial/templates/gitweb/map
@@ -102,6 +102,13 @@  annotateline = '
               title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a>',
           '')}
     </td>
+    <td>
+      {if(blockhead,
+          '<a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}"
+              title="diff {file|urlescape}@{node|short}">diff</a>
+           <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}"
+              title="{node|short}: {desc|escape|firstline}">rev</a>', '')}
+    </td>
     <td><pre><a class="linenr" href="#{lineid}">{linenumber}</a></pre></td>
     <td><pre>{line|escape}</pre></td>
   </tr>'
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
@@ -617,7 +617,11 @@  Set up the repo
   <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"
+  <a href="/rev/43c799df6e75?style=gitweb"
   <a href="/annotate/a7c1559b7bba/foo?style=gitweb#l2"
+  <a href="/diff/a7c1559b7bba/foo?style=gitweb"
+  <a href="/rev/a7c1559b7bba?style=gitweb"
 
   $ "$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> |