Mercurial > hg
comparison mercurial/help/templates.txt @ 29717:a12d13eac513 stable
help: add example of '[templates]' usage
V2:
- move from shortest() with minlength 8 to minlength 4
- mention [templates] in config.txt
- better describe the difference between [templatealias] and [templates]
V3:
- choose a better example template
author | Mathias De Maré <mathias.demare@gmail.com> |
---|---|
date | Mon, 08 Aug 2016 16:47:42 +0200 |
parents | df838803c1d4 |
children | e83f89d3b1f7 |
comparison
equal
deleted
inserted
replaced
29704:b8f9cdca8807 | 29717:a12d13eac513 |
---|---|
68 rn = "{r}:{node|short}" | 68 rn = "{r}:{node|short}" |
69 leftpad(s, w) = pad(s, w, ' ', True) | 69 leftpad(s, w) = pad(s, w, ' ', True) |
70 | 70 |
71 defines two symbol aliases, ``r`` and ``rn``, and a function alias | 71 defines two symbol aliases, ``r`` and ``rn``, and a function alias |
72 ``leftpad()``. | 72 ``leftpad()``. |
73 | |
74 It's also possible to specify complete template strings, using the | |
75 ``templates`` section. The syntax used is the general template string syntax. | |
76 | |
77 For example, | |
78 | |
79 :: | |
80 | |
81 [templates] | |
82 nodedate = "{node|short}: {date(date, "%Y-%m-%d")}\n" | |
83 | |
84 defines a template, ``nodedate``, which can be called like:: | |
85 | |
86 $ hg log -r . -Tnodedate | |
73 | 87 |
74 Some sample command line templates: | 88 Some sample command line templates: |
75 | 89 |
76 - Format lists, e.g. files:: | 90 - Format lists, e.g. files:: |
77 | 91 |