diff mercurial/help/templates.txt @ 21846:8f23f8096606

templater: introduce word function This function allows returning only the nth "word" from a string. By default a string is split as by Python's split() function default, but an optional third parameter can also override what string the string is split by.
author Ryan McElroy <rmcelroy@fb.com>
date Thu, 12 Jun 2014 18:02:23 -0700
parents 4a445dc5abff
children 8534e670f4ee
line wrap: on
line diff
--- a/mercurial/help/templates.txt	Thu Jul 03 23:01:37 2014 -0500
+++ b/mercurial/help/templates.txt	Thu Jun 12 18:02:23 2014 -0700
@@ -72,6 +72,8 @@
 
 - sub(pat, repl, expr)
 
+- word(number, text[, separator])
+
 Also, for any expression that returns a list, there is a list operator:
 
 - expr % "{template}"
@@ -130,3 +132,7 @@
 - Show only commit descriptions that start with "template"::
 
    $ hg log --template "{startswith(\"template\", firstline(desc))}\n"
+
+- Print the first word of each line of a commit message::
+
+   $ hg log --template "{word(\"0\", desc)}\n"