[PATCH 1 of 2] template: add shortestnode keyword

Matt Mackall mpm at selenic.com
Fri Jan 17 21:35:32 CST 2014


On Fri, 2014-01-17 at 18:29 +0000, Durham Goode wrote:
> On 1/17/14 5:24 AM, "Mads Kiilerich" <mads at kiilerich.com> wrote:
> 
> >On 01/17/2014 09:45 AM, Durham Goode wrote:
> >> # HG changeset patch
> >> # User Durham Goode <durham at fb.com>
> >> # Date 1389946237 28800
> >> #      Fri Jan 17 00:10:37 2014 -0800
> >> # Node ID b18359a70b640d2aeb3f4afd1c8e47d775402b8e
> >> # Parent  6545770bd37991b4ff0400479455a6e3ffa5976b
> >> template: add shortestnode keyword
> >>
> >> I wanted to do this as a filter, like '{node|shortest}', but filters
> >>don't
> >> have access to the repo.
> >
> >Could that be fixed so we could do it the preferred way instead?
> 
> I wasn't sure if filters were meant to be super simple string
> manipulations.

Less and less so. I'm actually trying to move away from the filter-style
syntax to a function-style (eg the equivalent {shortest(node)}) and
functions can be much richer.

>  I also thought the current version would be more likely to
> get accepted before the code freeze than a version that touched every
> filter method.

I think there's maybe a way to do this that avoids that. For instance,
make it a template function instead of a filter and pass the repo or
changectx around in the context or mapping. 

Having access to the repo or context from templates opens up a whole
bunch of possibilities.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list