# HG changeset patch # User Yuya Nishihara # Date 1427461973 -32400 # Node ID c1cb6523e9681f0c3a426ce360ffe2ec03bdece8 # Parent 36872036169b27885abb2e464a637e15e9b60de1 templates-default: do not show description or summary if empty changeset_printer shows description only if ctx.description().strip() is not empty. The default template should do the same way. diff -r 36872036169b -r c1cb6523e968 mercurial/templates/map-cmdline.default --- a/mercurial/templates/map-cmdline.default Mon Apr 06 10:51:53 2015 -0700 +++ b/mercurial/templates/map-cmdline.default Fri Mar 27 22:12:53 2015 +0900 @@ -58,8 +58,8 @@ user = '{label("log.user", "user: {author}")}\n' -summary = '{label("log.summary", - "summary: {desc|firstline}")}\n' +summary = '{if(desc|strip, "{label('log.summary', + 'summary: {desc|firstline}')}\n")}' ldate = '{label("log.date", "date: {date|date}")}\n' @@ -67,7 +67,7 @@ extra = '{label("ui.debug log.extra", "extra: {key}={value|stringescape}")}\n' -description = '{label("ui.note log.description", - "description:")} - {label("ui.note log.description", - "{desc|strip}")}\n\n' +description = '{if(desc|strip, "{label('ui.note log.description', + 'description:')} + {label('ui.note log.description', + '{desc|strip}')}\n\n")}' diff -r 36872036169b -r c1cb6523e968 tests/test-command-template.t --- a/tests/test-command-template.t Mon Apr 06 10:51:53 2015 -0700 +++ b/tests/test-command-template.t Fri Mar 27 22:12:53 2015 +0900 @@ -96,6 +96,10 @@ Default style is like normal output: + $ echo c >> c + $ hg add c + $ hg commit -qm ' ' + $ hg log > log.out $ hg log --style default > style.out $ cmp log.out style.out || diff -u log.out style.out @@ -135,6 +139,8 @@ $ mv $HGRCPATH-bak $HGRCPATH + $ hg --config extensions.strip= strip -q . + Revision with no copies (used to print a traceback): $ hg tip -v --template '\n'