[PATCH 3 of 4] hgweb: add ancestors blame info in annotate hgweb template

Yuya Nishihara yuya at tcha.org
Wed Jun 8 09:14:25 EDT 2016


On Mon, 06 Jun 2016 10:03:19 +0200, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde at logilab.fr>
> # Date 1464943305 -7200
> #      Fri Jun 03 10:41:45 2016 +0200
> # Node ID ecadc1da55f84fd77110ca23341e12949110d46c
> # Parent  632a34ed3b63420e1444cb4c3a09a0692b274615
> hgweb: add ancestors blame info in annotate hgweb template
> 
> In gitweb style, display this ancestors information in a new column on the
> left of the revision's one.

I know it is useful to navigate to the parent revision, but this seems a bit
verbose. The parent revision has no relation to the line where it is displayed.

> diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
> --- a/mercurial/hgweb/webcommands.py
> +++ b/mercurial/hgweb/webcommands.py
> @@ -863,6 +863,16 @@ def annotate(web, req, tmpl):
>      diffopts = patch.difffeatureopts(web.repo.ui, untrusted=True,
>                                       section='annotate', whitespace=True)
>  
> +    def ancestors(f):
> +        for p in f.parents():
> +            yield {
> +                "node": p.hex(),
> +                "rev": p.rev(),
> +                "author": p.user(),
> +                "desc": p.description(),
> +                "file": p.path(),
> +            }
> +
>      def annotate(**map):
>          if util.binary(fctx.data()):
>              mt = (mimetypes.guess_type(fctx.path())[0]
> @@ -877,6 +887,7 @@ def annotate(web, req, tmpl):
>                     "node": f.hex(),
>                     "rev": f.rev(),
>                     "author": f.user(),
> +                   "ancestors": ancestors(f),

Nit: "ancestors" sounds as if it would return all ancestors.


More information about the Mercurial-devel mailing list