NewLine handling in templates

Ernie Rael errael at raelity.com
Wed Nov 16 22:07:38 UTC 2022


Hi all,

I don't use templates much, I'm running into something that doesn't seem 
to make sense. I guess it's a bug in glog. Wondering if I'm 
understanding things correctly.

I want to include some bookmark info in a template I use to summarize log.

It looks like the trailing "\n" in the first template gets lost when 
there are bookmarks present, and this seems to be confirmed by the 
second template which uses "{if(bookmarks, '\n')}" as a fixup. The 
behavior using log instead of glog is as expected.

hg glog -T"{bookmarks % '{bookmark}\n'}{rev} {phase}\n"
o  MaskFormattingJavadocCleanup
|  1177 draft
o  4.0.11-SNAPSHOT
|  1175 draft
o    1172 draft
|\
| o  1171 draft
| |
| o  1170 draft
| |


hg glog -T"{bookmarks % '{bookmark}\n'}{rev} {phase}{if(bookmarks, '\n')}\n"
o  MaskFormattingJavadocCleanup
|  1177 draft
|
o  4.0.11-SNAPSHOT
|  1175 draft
|
o    1172 draft
|\
| o  1171 draft
| |
| o  1170 draft
| |

-ernie



More information about the Mercurial mailing list