[PATCH STABLE] template-phases: do not show description or summary if empty

Jordi Gutiérrez Hermoso jordigh at octave.org
Fri Apr 24 15:33:13 UTC 2015


# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh at octave.org>
# Date 1429883502 14400
#      Fri Apr 24 09:51:42 2015 -0400
# Branch stable
# Node ID e6164639db5c4ab95ea86b4b6d55ed3d8e84ad10
# Parent  ca1ad8ef38be225caec42564502aafe43cae173d
template-phases: do not show description or summary if empty

This is a copy of c1cb6523e968, but applied to the phases template,
which is itself almost a copy of the default template.

Perhaps there should be some sort of template inclusion syntax so that
we can reuse common parts of templates without having to patch the
same thing twice. Most templating engines offer this kind of
inheritance.

diff --git a/mercurial/templates/map-cmdline.phases b/mercurial/templates/map-cmdline.phases
--- a/mercurial/templates/map-cmdline.phases
+++ b/mercurial/templates/map-cmdline.phases
@@ -58,8 +58,8 @@ bookmark = '{label("log.bookmark",
 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 @@ ldate = '{label("log.date",
 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")}'


More information about the Mercurial-devel mailing list