[PATCH 1 of 3 V2] gitweb: highlight data of the current revision in annotate view

Yuya Nishihara yuya at tcha.org
Fri Jun 10 09:18:22 EDT 2016


On Thu, 9 Jun 2016 23:34:50 -0400, Augie Fackler wrote:
> On Thu, Jun 09, 2016 at 09:37:19PM +0800, Anton Shestakov wrote:
> > 09.06.2016, 20:35, "Denis Laxalde" <denis.laxalde at logilab.fr>:  
> > > # HG changeset patch
> > > # User Denis Laxalde <denis.laxalde at logilab.fr>
> > > # Date 1464877610 -7200
> > > # Thu Jun 02 16:26:50 2016 +0200
> > > # Node ID 3064963ddbc0b509c0f3f8149ca2c6edb2edb568
> > > # Parent 75a86bf04cb2a2b74e6ca26f742f4f8b97c4a008
> > > 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
> > > @@ -858,6 +858,7 @@ def annotate(web, req, tmpl):
> > >      The ``fileannotate`` template is rendered.
> > >      """
> > >      fctx = webutil.filectx(web.repo, req)
> > > + blamedrev = fctx.rev()  
> 
> I agree with Anton - this would be better named "annotrev" or
> something so it's consistent with the annotate terminology.
> 
> > >      f = fctx.path()
> > >      parity = paritygen(web.stripecount)
> > >      diffopts = patch.difffeatureopts(web.repo.ui, untrusted=True,
> > > @@ -876,6 +877,7 @@ def annotate(web, req, tmpl):
> > >              yield {"parity": next(parity),
> > >                     "node": f.hex(),
> > >                     "rev": f.rev(),
> > > + "blamedrev": blamedrev,
> > >                     "author": f.user(),
> > >                     "desc": f.description(),
> > >                     "extra": f.extra(),

I meant "originalnode", literally. It's sort of black magic, but can avoid
introducing new keyword since fctx.node() is passed to the templater.

https://selenic.com/repo/hg/file/3.8.3/mercurial/templater.py#l399


More information about the Mercurial-devel mailing list