Writing a template which displays only relevant parents
Dr Rainer Woitok
rainer.woitok at gmail.com
Thu Feb 4 16:42:35 UTC 2016
Greetings,
part of my template to display a changeset is
{if(parents,"\n<-{p1rev}:{p1node|short}{ifeq(p2rev,-1,'',',{p2rev}:{p2node|short}')}")}
and this works. However, I want to improve this output in such a way
that trivial parents (immediately preceding revisions) are replaced with
an asterisk. Something like (in a hypothetical programming language):
if ( rev - 1 == p1rev )
then "*"
else "{p1rev}:{p1node|short}"
if ( p2rev == -1 )
then ""
elif ( rev - 1 == p2rev )
then ",*"
else ",{p2rev}:{p2node|short}"
But I haven't yet found a way to do math (yes, it IS "the supreme nost-
algia of our time" :-) in a template. Or is there any other way to ach-
ieve what I want?
Any pointers welcome.
Sincerely,
Rainer
More information about the Mercurial
mailing list