[PATCH 2 of 8] templater: add revdesc function

timeless timeless at gmail.com
Fri Sep 11 12:40:35 CDT 2015


A real world example is something like revset(children(...)) %
{display information as one would for log per child}.

The previous patch included a full test template for log output, in
this series, pushgate stopped submitting patches at 8 (iirc the full
test was #11).

On Fri, Sep 11, 2015 at 11:45 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> On Thu, 10 Sep 2015 22:36:40 -0500, timeless at mozdev.org wrote:
>> # HG changeset patch
>> # User timeless at mozdev.org
>> # Date 1441937881 14400
>> #      Thu Sep 10 22:18:01 2015 -0400
>> # Node ID cc0d4af57610091f9e637dd3a4b11f4ae6b78498
>> # Parent  404f89e718a2866eaed6eef778b9eafe00f1f9ae
>> templater: add revdesc function
>>
>> revdesc takes a revision and returns its description
>>
>> for use like:
>>   {revset("...") % "{revision|revdesc}"}
>
> I don't think it's good idea to add rev*() function for each template keyword.
> Instead, we can
>
>  a. switch the ctx by revset(), which is a behavior change
>
>     {revset("...") % "{desc}"}
>                      ~~~~~~~~
>                      here mapping['ctx'] points to repo[revision]
>
>  b. add function or operator that switches the ctx
>
>     {revset("...") % "{desc[revision]}"}
>     or
>     {revset("...") % "{xxx(revision, desc)}"}
>     or
>     {revset("...")|xxx % "{desc}"}
>
>> +  $ hg log -r 0 --template '{revset("0::0") % "summary:\t{revision|revdesc|firstline}\n"}\n'
>> +  summary:   A1B1C1
>
> Is there a real-world example how rev*() function will be used effectively?
> Maybe it should be listed in help/templates.txt.
>
> Regards,
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list