[PATCH] templates: add {lasttag} and {lasttagdistance} keywords

Mads Kiilerich mads at kiilerich.com
Tue Jul 21 16:29:54 CDT 2009

Gilles Moris wrote, On 07/21/2009 10:51 PM:
> On Wed July 15 2009 03:02:33 Mads Kiilerich wrote:
>> For revisions without any tagged ancestors I would rather have the
>> distance to the first revision than nothing. Using the "null" revision
>> would be an obvious choice:
>>           defvalue = 0, 'null', 0
> OK, I just put some parenthesis around null to show it is not an actual tag.

"null" might not be a tag, but it designates a revision and is almost 
indistinguishable from a tag. See "hg help revisions". I really do think 
that it is unfortunate to put paranthesis around it. Please reconsider.

>> Or actually ... for some uses it would be nice to have a simple template
>> which gives "1.3" instead of "1.3-0" or "1.3-" - but it should still
>> give for example "1.3-117".
>> Perhaps a {lasttaganddistance} would be useful too?
> Personally I prefer it with a '+' to show that it's after the tag.
> So I think it's better to stay like that and let the people choose their
> format.

I agree that "+" might make more sense. But it just feels wrong. 
Everybody else uses "-" and don't consider it a minus, it is just a 
separator. So yes, hardcoding it might a bad idea...

But still it would be nice to be able to create a template which just 
gave the tag if the distance was 0. I will dream up a filter like 


More information about the Mercurial-devel mailing list