Patchwork [4,of,4] show: use filter() function to strip "tip" tag

login
register
mail settings
Submitter Yuya Nishihara
Date June 23, 2018, 9:51 a.m.
Message ID <7d4982dc9d52624ebd62.1529747501@mimosa>
Download mbox | patch
Permalink /patch/32391/
State New
Headers show

Comments

Yuya Nishihara - June 23, 2018, 9:51 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1528986171 -32400
#      Thu Jun 14 23:22:51 2018 +0900
# Node ID 7d4982dc9d52624ebd62f249639ca596101415ca
# Parent  f2d42f1933ce7e28647f2b834c86de3369fbbe00
show: use filter() function to strip "tip" tag

Before, an empty tag "" was inserted in place of "tip", resulting in double
spaces.

Patch

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,8 +15,11 @@  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(stringify(names % "{ifeq(name, 'tip', '', name)}"),
-                  " ({label('log.{colorname}', join(names % "{ifeq(name, 'tip', '', name)}", ' '))})")}'
+names_tags = '{if(filter_tags(names),
+                  " ({label('log.{colorname}', join(filter_tags(names), ' '))})")}'
 names_others = '{if(names, " ({label('log.{colorname}', join(names, ' '))})")}'
 
 cset_shortdesc = '{label("log.description", desc|firstline)}'
+
+[templatealias]
+filter_tags(names) = filter(names, ifeq(name, 'tip', '', name))