[PATCH 00 of 10 RFC] adding labels to the template engine

Matt Mackall mpm at selenic.com
Fri Dec 21 01:43:32 CST 2012


On Thu, 2012-12-20 at 23:37 -0600, Sean Farley wrote:
> I'm looking for some feedback for my attempt at adding label data to
> the template engine. I had some questions arise while I was working on
> this patch series and before sending the whole thing to the list, I
> thought I would send some preliminary work with questions in the
> comments of the code and/ or the commit message.

I had to read quite a ways into this series to figure out what the point
of this was, which is apparently: add color support to command-line
templates.

For one thing, I think this will run afoul of the infrastructure that
I've been working on for GenericTemplating. For another, we're going to
have contexts other than 'log' in templating. Lastly, it complexifies
the templater quite a bit for a feature I have only seen one person
express interest in.

It might instead be better for color.py to extend the template functions
so that people writing templates can do something like:

 {color('log.user', user)}

or even

 {color('blue', user)}

that simply adds in the relevant escape codes to the provided string
when using a tty and ends up being very simple to write.

Alternately, we can have a no-op predicate like label() that color.py
overrides:

 {label('log.user', user)}

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list