NewLine handling in templates

Yuya Nishihara yuya at tcha.org
Thu Nov 17 03:36:22 UTC 2022


On Wed, 16 Nov 2022 14:07:38 -0800, Ernie Rael wrote:
> 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
> | |

I don't fully understand the problem, but glog needs to allocate enough
height to draw the graph, maybe which is why the output looks different
from the plain log. "hg glog -T." appends extra "\n\n" for example.


More information about the Mercurial mailing list