json output using mercurial templates

Matt Mackall mpm at selenic.com
Wed Nov 24 12:35:11 CST 2010


On Wed, 2010-11-24 at 10:19 +0100, Dirkjan Ochtman wrote:
> On Wed, Nov 24, 2010 at 10:11, Matt Mackall <mpm at selenic.com> wrote:
> > Hopefully I'll get around to making the template language more powerful
> > shortly. I plan to add:
> >
> > - some basic conditionals
> > - filters with arguments
> > - inline subtemplates
> > - a nice list join function
> >
> > This shouldn't be too hard to do with the simple parser tech I added for
> > revsets.
> 
> Sounds nice. Please share the proposed syntax sometime. Can you add
> all of this without regressing the templater's performance?

I don't know when you last looked, but templates are now parsed with a
fast regex-free lexer/parser and compiled down to cached threaded code
(ie dispatched by looping through an array of function pointers). That
will continue to be the case in the future. The overhead of the template
engine itself is pretty small.

I think there's something suboptimal happening with sharing the template
cache between hgweb requests though.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial mailing list