On Sun, 25 Jun 2017 08:19:29 -0400, Yuya Nishihara <y...@tcha.org> wrote:
On Sun, 25 Jun 2017 01:23:41 -0400, Matt Harbison wrote:
# HG changeset patch
# User Matt Harbison <matt_harbi...@yahoo.com>
# Date 1498360161 14400
# Sat Jun 24 23:09:21 2017 -0400
# Node ID 1e917448c8d5c36f19c41bc83793df3e92477ede
# Parent 8299eb9b08c79699f496717d626842b72fa5ca4f
identify: add template support
...
Yuya mentioned using fm.nested() in that thread, so I did for the
parent nodes.
I'm not sure if the plan is to fill in all of the context attributes in
these
items, or if these nested items should simply be made {p1node} and
{p1rev}.
[...]
+ for i, p in enumerate(parents):
+ fn = fm.nested('p%d' % (i + 1))
+ fn.startitem()
+ fn.data(rev=p.rev())
+ fn.data(node=p.hex())
+ fn.end()
I meant this could be a {parents} list, which is
fn = fm.nested('parents')
for ...
fn.startitem()
...
Each item could have fn.context(ctx=p) so that all template keywrods are
available.
I saw that, and tried it, but I didn't think it worked. I was expecting
lines in the json output I guess. But after digging in a bit more, maybe
it's just a bug in nested formatters? `hg branches` works fine for both
functions and keywords. But (on default in the hg repo):
$ ../hg id -T "{p1 % '{latesttag}\n'}"
$ ../hg id -T "{p1 % '{latesttag()}\n'}"
** unknown exception encountered, please report by visiting
[...]
File "c:\Users\Matt\projects\hg\mercurial\templatekw.py", line 486, in
showlatesttags
repo, ctx = args['repo'], args['ctx']
KeyError: 'repo'
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel