Show More
@@ -16,6 +16,9 b' expansion::' | |||
|
16 | 16 | $ hg log -r1 --template "{node}\n" |
|
17 | 17 | b56ce7b07c52de7d5fd79fb89701ea538af65746 |
|
18 | 18 | |
|
19 | Keywords | |
|
20 | ======== | |
|
21 | ||
|
19 | 22 | Strings in curly braces are called keywords. The availability of |
|
20 | 23 | keywords depends on the exact context of the templater. These |
|
21 | 24 | keywords are usually available for templating a log-like command: |
@@ -32,6 +35,9 b' You can also use a chain of filters to g' | |||
|
32 | 35 | $ hg tip --template "{date|isodate}\n" |
|
33 | 36 | 2008-08-21 18:22 +0000 |
|
34 | 37 | |
|
38 | Filters | |
|
39 | ======= | |
|
40 | ||
|
35 | 41 | List of filters: |
|
36 | 42 | |
|
37 | 43 | .. filtersmarker |
@@ -39,10 +45,16 b' List of filters:' | |||
|
39 | 45 | Note that a filter is nothing more than a function call, i.e. |
|
40 | 46 | ``expr|filter`` is equivalent to ``filter(expr)``. |
|
41 | 47 | |
|
48 | Functions | |
|
49 | ========= | |
|
50 | ||
|
42 | 51 | In addition to filters, there are some basic built-in functions: |
|
43 | 52 | |
|
44 | 53 | .. functionsmarker |
|
45 | 54 | |
|
55 | Infix | |
|
56 | ===== | |
|
57 | ||
|
46 | 58 | We provide a limited set of infix arithmetic operations on integers:: |
|
47 | 59 | |
|
48 | 60 | + for addition |
@@ -60,6 +72,9 b' As seen in the above example, ``{templat' | |||
|
60 | 72 | To prevent it from being interpreted, you can use an escape character ``\{`` |
|
61 | 73 | or a raw string prefix, ``r'...'``. |
|
62 | 74 | |
|
75 | Aliases | |
|
76 | ======= | |
|
77 | ||
|
63 | 78 | New keywords and functions can be defined in the ``templatealias`` section of |
|
64 | 79 | a Mercurial configuration file:: |
|
65 | 80 | |
@@ -94,6 +109,9 b' defines a template, ``nodedate``, which ' | |||
|
94 | 109 | |
|
95 | 110 | $ hg log -r . -Tnodedate |
|
96 | 111 | |
|
112 | Examples | |
|
113 | ======== | |
|
114 | ||
|
97 | 115 | Some sample command line templates: |
|
98 | 116 | |
|
99 | 117 | - Format lists, e.g. files:: |
General Comments 0
You need to be logged in to leave comments.
Login now