[PATCH 4 of 5 V2] templates: add support for search webcommand in json style

Yuya Nishihara yuya at tcha.org
Mon Jun 20 09:22:44 EDT 2016


On Mon, 20 Jun 2016 10:49:13 +0200, Laura Médioni wrote:
> On 06/16/2016 12:07 PM, Anton Shestakov wrote:
> > 15.06.2016, 22:48, "Laura Médioni" <laura.medioni at logilab.fr>:
> >> # HG changeset patch
> >> # User Laura Médioni <laura.medioni at logilab.fr>
> >> # Date 1465547502 -7200
> >> # Fri Jun 10 10:31:42 2016 +0200
> >> # Node ID 33c362973b2ab07b2e20d6818b7e72473e682fd4
> >> # Parent f4aad36209542e836d91477ce330b2dbb5181443
> >> templates: add support for search webcommand in json style
> >>
> >> diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map
> >> --- a/mercurial/templates/json/map
> >> +++ b/mercurial/templates/json/map
> >> @@ -13,11 +13,16 @@ filerevision = '\{
> >>     "lines": [{join(text%lineentry, ", ")}]
> >>     }'
> >>   lineentry = '\{
> >>     "line": {line|json}
> >>     }'
> >> -search = '"not yet implemented"'
> >> +search = '\{
> >> + "node": {node|json},
> >> + "query": {query|json},
> >> + "entries": [{join(entries%searchentry, ", ")}]
> >> + }'
> >> +searchentry = '{changeset}'
> > It's better to use a template directly for clarity, since searchentry doesn't do anything on its own.
> 
> If I directly write something like " "entries": 
> [{join(entries%changelistentry, ", ")}] ", I got a json decoding error. 
> I guess that is because the template is named "searchentry".

Yep, you can write it as 'entries % changeset' or 'entries % "{changeset}"',
but still "searchentry" key is required.


More information about the Mercurial-devel mailing list