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