mercurial/templates/map-cmdline.default
changeset 34716 d36a36ca7bc2
parent 34714 f4aeb952ab77
child 34717 06b52671552b
--- a/mercurial/templates/map-cmdline.default	Sat Oct 14 18:06:42 2017 +0900
+++ b/mercurial/templates/map-cmdline.default	Sat Oct 14 18:24:01 2017 +0900
@@ -30,19 +30,12 @@
                                                % ' {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 @@
                                        '{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)