[PATCH] hgweb: add parents to json-log (issue5074)
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Fri Apr 1 04:28:04 UTC 2016
On 03/31/2016 04:40 AM, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <av6 at dwimlabs.net>
> # Date 1459418949 -28800
> # Thu Mar 31 18:09:09 2016 +0800
> # Node ID d3b8071f35d78aded26801a169e9a3d250909b34
> # Parent ff0d3b6b287f89594bd8d0308fe2810d2a18ea01
> hgweb: add parents to json-log (issue5074)
pushed with a small comment, thanks.
>
> Entries prepared in webutil.changelistentry() skip showing parents in the
> trivial case when there's only one parent and it's the previous revision. This
> doesn't work well for the json-log template, which is supposed to just dump raw
> data in an easy-to-parse format, so let's provide all parents as another
> keyword: allparents.
>
> Using a lambda function here means that the performance of templates that don't
> use allparents won't be affected (see 41957e50e109).
>
> diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
> --- a/mercurial/hgweb/webutil.py
> +++ b/mercurial/hgweb/webutil.py
> @@ -341,6 +341,7 @@ def changelistentry(web, ctx, tmpl):
>
> entry = commonentry(repo, ctx)
> entry.update(
> + allparents=lambda **x: parents(ctx),
> parent=lambda **x: parents(ctx, rev - 1),
> child=lambda **x: children(ctx, rev + 1),
> changelogtag=showtags,
> diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map
> --- a/mercurial/templates/json/map
> +++ b/mercurial/templates/json/map
> @@ -11,7 +11,8 @@ changelistentry = '\{
> "desc": {desc|utf8|json},
> "bookmarks": [{join(bookmarks%changelistentryname, ", ")}],
> "tags": [{join(tags%changelistentryname, ", ")}],
> - "user": {author|utf8|json}
> + "user": {author|utf8|json},
> + "parents": [{join(allparents%changesetparent, ", ")}]
The way we build the list make me a bit sad, but this seems standard
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list