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

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date April 24, 2015, 3:33 p.m.
Message ID <e6164639db5c4ab95ea8.1429889593@Iris>
Download mbox | patch
Permalink /patch/8784/
State Superseded
Commit 6518880de1b3bad6303a7e3cef542c1080ebed27
Headers show

Comments

Jordi Gutiérrez Hermoso - April 24, 2015, 3:33 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@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.
Pierre-Yves David - April 24, 2015, 3:51 p.m.
On 04/24/2015 04:33 PM, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@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

Can we get a test for that (it will also help to have an idea of what it 
is about)
Yuya Nishihara - April 24, 2015, 4:22 p.m.
On Fri, 24 Apr 2015 16:51:25 +0100, Pierre-Yves David wrote:
> On 04/24/2015 04:33 PM, Jordi Gutiérrez Hermoso wrote:
> > # HG changeset patch
> > # User Jordi Gutiérrez Hermoso <jordigh@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
> 
> Can we get a test for that (it will also help to have an idea of what it 
> is about)

I have the test for this, but sadly it relies on wdir() revision, which can't
be used in templater yet. ;)
Matt Mackall - April 24, 2015, 6:36 p.m.
On Fri, 2015-04-24 at 11:33 -0400, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@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

Queued for stable, thanks.

Patch

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")}'