[PATCH 6 of 7] show: stringify filtered list of tags before testing emptiness

Yuya Nishihara yuya at tcha.org
Tue Jun 12 10:49:08 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1528813058 -32400
#      Tue Jun 12 23:17:38 2018 +0900
# Node ID 0bf2bc3ec4f89f4a847b68d00011968732aacd7a
# Parent  bc18058428fc50a9da867e9fd8a3c9f15f133851
show: stringify filtered list of tags before testing emptiness

`names % "{ifeq(name, 'tip', '', name)}"}"` may return [''], which shouldn't
be falsy, but it is thanks to a templater bug. This patch converts [''] to ''
before testing truthness.

diff --git a/mercurial/templates/map-cmdline.show b/mercurial/templates/map-cmdline.show
--- a/mercurial/templates/map-cmdline.show
+++ b/mercurial/templates/map-cmdline.show
@@ -15,7 +15,8 @@ cset_shortnode = '{labelcset(shortest(no
 # Treat branch and tags specially so we don't display "default" or "tip"
 cset_namespace = '{ifeq(namespace, "branches", names_branches, ifeq(namespace, "tags", names_tags, names_others))}'
 names_branches = '{ifeq(branch, "default", "", " ({label('log.{colorname}', branch)})")}'
-names_tags = '{if(names % "{ifeq(name, 'tip', '', name)}", " ({label('log.{colorname}', join(names % "{ifeq(name, 'tip', '', name)}", ' '))})")}'
+names_tags = '{if(stringify(names % "{ifeq(name, 'tip', '', name)}"),
+                  " ({label('log.{colorname}', join(names % "{ifeq(name, 'tip', '', name)}", ' '))})")}'
 names_others = '{if(names, " ({label('log.{colorname}', join(names, ' '))})")}'
 
 cset_shortdesc = '{label("log.description", desc|firstline)}'


More information about the Mercurial-devel mailing list