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

Augie Fackler raf at durin42.com
Thu Jun 9 23:34:50 EDT 2016


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(),
> > diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map

I assume patches for other styles are forthcoming once we get
consensus on the initial version for gitweb?


> > --- a/mercurial/templates/gitweb/map
> > +++ b/mercurial/templates/gitweb/map
> > @@ -98,10 +98,11 @@ annotateline = '
> >    <tr id="{lineid}" style="font-family:monospace" class="parity{parity}">
> >      <td class="linenr" style="text-align: right;">
> >        <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#l{targetline}"
> > + {ifeq(rev, blamedrev, 'class="blamedrev"', '')}
> >           title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a>
> >      </td>
> >      <td><pre><a class="linenr" href="#{lineid}">{linenumber}</a></pre></td>
> > - <td><pre>{line|escape}</pre></td>
> > + <td><pre{ifeq(rev, blamedrev, ' class="blamedrev"', '')}>{line|escape}</pre></td>
> >    </tr>'
>
> It's also possible to set the class to the whole <tr>, which already has a class, that would avoid the duplication.
>
> Nit: I actually liked the name "thisrev" more, maybe because revision is more like a generic context in hgweb, and, technically, we don't blame the revision, we're blaming a file (but for this revision).
>
> Also, while "blame" is an alias to "annotate", it's used very rarely in hgweb and in Mercurial in general (in some part because of the negative connotation).
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list