[PATCH 4 of 4] gitweb: highlight data of the current revision in annotate view

Yuya Nishihara yuya at tcha.org
Wed Jun 8 08:38:29 EDT 2016


On Mon, 06 Jun 2016 10:03:20 +0200, Denis Laxalde wrote:
> # 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"', '')}

You can do ifeq(node, originalnode, ...) instead of introducing one-off keyword.


More information about the Mercurial-devel mailing list