[PATCH 4 of 4] gitweb: highlight data of the current revision in annotate view
Denis Laxalde
denis.laxalde at logilab.fr
Mon Jun 6 08:03:20 UTC 2016
# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1464877610 -7200
# Thu Jun 02 16:26:50 2016 +0200
# Node ID b2197fb3124e53902437e9e81463281a85d7bbbd
# Parent ecadc1da55f84fd77110ca23341e12949110d46c
gitweb: highlight data of the current revision in annotate view
* Distinguish the /annotate/<revision>/<file>#<linenumber> link when it would
lead to the current page (i.e. <revision> is the current revision) (style it
gray and undecorated). This indicates more clearly that this is a "dead-end"
in blame navigation.
* Display lines changed in current revision in green.
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -883,9 +883,11 @@ def annotate(web, req, tmpl):
lines = enumerate(fctx.annotate(follow=True, linenumber=True,
diffopts=diffopts))
for lineno, ((f, targetline), l) in lines:
+ rev = f.rev()
yield {"parity": next(parity),
"node": f.hex(),
- "rev": f.rev(),
+ "rev": rev,
+ "thisrev": fctx.rev() == rev or None,
"author": f.user(),
"ancestors": ancestors(f),
"desc": f.description(),
diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map
--- a/mercurial/templates/gitweb/map
+++ b/mercurial/templates/gitweb/map
@@ -101,6 +101,7 @@ annotateline = '
</td>
<td class="linenr" style="text-align: left;">
<a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#l{targetline}"
+ {if(thisrev, 'class="linenr"', '')}
title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a>
</td>
<td>
@@ -110,7 +111,7 @@ annotateline = '
title="rev">rev</a>
</td>
<td><pre><a class="linenr" href="#{lineid}">{linenumber}</a></pre></td>
- <td><pre>{line|escape}</pre></td>
+ <td><pre{if(thisrev, ' class="thisrev"', '')}>{line|escape}</pre></td>
</tr>'
annotateentry = '
<a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}"
diff --git a/mercurial/templates/static/style-gitweb.css b/mercurial/templates/static/style-gitweb.css
--- a/mercurial/templates/static/style-gitweb.css
+++ b/mercurial/templates/static/style-gitweb.css
@@ -54,6 +54,8 @@ div.diff_info { font-family:monospace; c
div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; }
div.search { margin:4px 8px; position:absolute; top:56px; right:12px }
a.revision-ancestor { font-style: italic; text-decoration: none }
+a.thisrev { color:#99999; text-decoration: none }
+pre.thisrev { color:#009900; }
.linenr { color:#999999; text-decoration:none }
div.rss_logo { float: right; white-space: nowrap; }
div.rss_logo a {
diff --git a/tests/test-hgweb.t b/tests/test-hgweb.t
--- a/tests/test-hgweb.t
+++ b/tests/test-hgweb.t
@@ -340,7 +340,7 @@ static file
$ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server
200 Script output follows
- content-length: 6624
+ content-length: 6705
content-type: text/css
body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; }
@@ -399,6 +399,8 @@ static file
div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; }
div.search { margin:4px 8px; position:absolute; top:56px; right:12px }
a.revision-ancestor { font-style: italic; text-decoration: none }
+ a.thisrev { color:#99999; text-decoration: none }
+ pre.thisrev { color:#009900; }
.linenr { color:#999999; text-decoration:none }
div.rss_logo { float: right; white-space: nowrap; }
div.rss_logo a {
More information about the Mercurial-devel
mailing list