[PATCH 5 of 6] templates: introduce labelcset() function in map-cmdline.default as example
Yuya Nishihara
yuya at tcha.org
Sat Oct 14 10:41:14 UTC 2017
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1507973041 -32400
# Sat Oct 14 18:24:01 2017 +0900
# Node ID 1fa8afb93739b8233c6744c2b59fec6e9dee073a
# Parent 48c3ed364bcac4e271d21cc1cde1c73704641b0c
templates: introduce labelcset() function in map-cmdline.default as example
diff --git a/mercurial/templates/map-cmdline.default b/mercurial/templates/map-cmdline.default
--- a/mercurial/templates/map-cmdline.default
+++ b/mercurial/templates/map-cmdline.default
@@ -30,19 +30,12 @@ lfile_copies_switch = '{if(file_copies_s
% ' {name} ({source})'}\n"))}'
# General templates
-_instability_label = 'instability.{instability}'
-_troubles_labels = '{if(instabilities, "changeset.unstable {instabilities%_instability_label}")}'
-_obsolete_label = '{if(obsolete, "changeset.obsolete")}'
-_cset_labels = '{separate(" ", "log.changeset", "changeset.{phase}", "{_obsolete_label}", "{_troubles_labels}")}'
-cset = '{label("{_cset_labels}",
- "changeset: {rev}:{node|short}")}\n'
+cset = '{labelcset("changeset: {rev}:{node|short}")}\n'
+fullcset = '{labelcset("changeset: {rev}:{node}")}\n'
lphase = '{label("log.phase",
"phase: {phase}")}\n'
-fullcset = '{label("{_cset_labels}",
- "changeset: {rev}:{node}")}\n'
-
parent = '{label("log.parent changeset.{phase}",
"parent: {rev}:{node|formatnode}")}\n'
@@ -82,3 +75,12 @@ description = '{if(desc|strip, "{label('
'{desc|strip}')}\n\n")}'
status = '{status} {path}\n{if(copy, " {copy}\n")}'
+
+[templatealias]
+labelcset(expr) = label(separate(" ",
+ "log.changeset",
+ "changeset.{phase}",
+ if(obsolete, "changeset.obsolete"),
+ if(instabilities, "changeset.unstable"),
+ instabilities % "instability.{instability}"),
+ expr)
More information about the Mercurial-devel
mailing list