# HG changeset patch # User Matt Harbison # Date 1483861381 18000 # Node ID 107014f4848ba51f40e96799e426871bc31ad2ae # Parent a4bc8fff67fcd6bfb8596e2c6cedd777e100379a help: apply the section headings from revsets to templates Unlike filesets, there are a few distinct headings that are not shared with revsets. But common names are used where possible. diff -r a4bc8fff67fc -r 107014f4848b mercurial/help/templates.txt --- a/mercurial/help/templates.txt Sun Jan 08 02:40:36 2017 -0500 +++ b/mercurial/help/templates.txt Sun Jan 08 02:43:01 2017 -0500 @@ -16,6 +16,9 @@ $ hg log -r1 --template "{node}\n" b56ce7b07c52de7d5fd79fb89701ea538af65746 +Keywords +======== + Strings in curly braces are called keywords. The availability of keywords depends on the exact context of the templater. These keywords are usually available for templating a log-like command: @@ -32,6 +35,9 @@ $ hg tip --template "{date|isodate}\n" 2008-08-21 18:22 +0000 +Filters +======= + List of filters: .. filtersmarker @@ -39,10 +45,16 @@ Note that a filter is nothing more than a function call, i.e. ``expr|filter`` is equivalent to ``filter(expr)``. +Functions +========= + In addition to filters, there are some basic built-in functions: .. functionsmarker +Infix +===== + We provide a limited set of infix arithmetic operations on integers:: + for addition @@ -60,6 +72,9 @@ To prevent it from being interpreted, you can use an escape character ``\{`` or a raw string prefix, ``r'...'``. +Aliases +======= + New keywords and functions can be defined in the ``templatealias`` section of a Mercurial configuration file:: @@ -94,6 +109,9 @@ $ hg log -r . -Tnodedate +Examples +======== + Some sample command line templates: - Format lists, e.g. files::