annotate mercurial/help/templates.txt @ 10061:9e2ab10728a2

Make {file_copies} usable as a --template key Before this, to display file copies in templates, you had to write something like {file_copies%filecopy}. For some reason, the {file_copy} subtemplate was used by default but not defined by default in changeset_templater, while styles were already using it. Here we define {file_copy} in changeset_templater, and change the templater to handle formatting strings like {file_copies%filecopy} with already expanded keys (in this case {file_copies}), for backward compatibility.
author Patrick Mezard <pmezard@gmail.com>
date Sun, 13 Dec 2009 18:06:24 +0100
parents f91e5630ce7e
children 788e7d04c594
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
1 Mercurial allows you to customize output of commands through
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
2 templates. You can either pass in a template from the command
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
3 line, via the --template option, or select an existing
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
4 template-style (--style).
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
5
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
6 You can customize output for any "log-like" command: log,
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
7 outgoing, incoming, tip, parents, heads and glog.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
8
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
9 Three styles are packaged with Mercurial: default (the style used
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
10 when no explicit preference is passed), compact and changelog.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
11 Usage::
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
12
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
13 $ hg log -r1 --style changelog
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
14
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
15 A template is a piece of text, with markup to invoke variable
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
16 expansion::
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
17
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
18 $ hg log -r1 --template "{node}\n"
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
19 b56ce7b07c52de7d5fd79fb89701ea538af65746
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
20
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
21 Strings in curly braces are called keywords. The availability of
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
22 keywords depends on the exact context of the templater. These
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
23 keywords are usually available for templating a log-like command:
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
24
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
25 :author: String. The unmodified author of the changeset.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
26 :branches: String. The name of the branch on which the changeset
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
27 was committed. Will be empty if the branch name was
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
28 default.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
29 :date: Date information. The date when the changeset was
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
30 committed.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
31 :desc: String. The text of the changeset description.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
32 :diffstat: String. Statistics of changes with the following
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
33 format: "modified files: +added/-removed lines"
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
34 :files: List of strings. All files modified, added, or removed
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
35 by this changeset.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
36 :file_adds: List of strings. Files added by this changeset.
10061
9e2ab10728a2 Make {file_copies} usable as a --template key
Patrick Mezard <pmezard@gmail.com>
parents: 9999
diff changeset
37 :file_copies: List of strings. Files copied in this changeset with
9e2ab10728a2 Make {file_copies} usable as a --template key
Patrick Mezard <pmezard@gmail.com>
parents: 9999
diff changeset
38 their sources.
9e2ab10728a2 Make {file_copies} usable as a --template key
Patrick Mezard <pmezard@gmail.com>
parents: 9999
diff changeset
39 :file_copies_switch: List of strings. Like "file_copies" but displayed
9e2ab10728a2 Make {file_copies} usable as a --template key
Patrick Mezard <pmezard@gmail.com>
parents: 9999
diff changeset
40 only if the --copied switch is set.
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
41 :file_mods: List of strings. Files modified by this changeset.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
42 :file_dels: List of strings. Files removed by this changeset.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
43 :node: String. The changeset identification hash, as a
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
44 40-character hexadecimal string.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
45 :parents: List of strings. The parents of the changeset.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
46 :rev: Integer. The repository-local changeset revision
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
47 number.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
48 :tags: List of strings. Any tags associated with the
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
49 changeset.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
50 :latesttag: String. Most recent global tag in the ancestors of this
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
51 changeset.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
52 :latesttagdistance: Integer. Longest path to the latest tag.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
53
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
54 The "date" keyword does not produce human-readable output. If you
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
55 want to use a date in your output, you can use a filter to process
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
56 it. Filters are functions which return a string based on the input
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
57 variable. You can also use a chain of filters to get the desired
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
58 output::
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
59
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
60 $ hg tip --template "{date|isodate}\n"
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
61 2008-08-21 18:22 +0000
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
62
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
63 List of filters:
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
64
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
65 :addbreaks: Any text. Add an XHTML "<br />" tag before the end of
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
66 every line except the last.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
67 :age: Date. Returns a human-readable date/time difference
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
68 between the given date/time and the current
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
69 date/time.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
70 :basename: Any text. Treats the text as a path, and returns the
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
71 last component of the path after splitting by the
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
72 path separator (ignoring trailing separators). For
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
73 example, "foo/bar/baz" becomes "baz" and "foo/bar//"
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
74 becomes "bar".
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
75 :stripdir: Treat the text as path and strip a directory level,
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
76 if possible. For example, "foo" and "foo/bar" becomes
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
77 "foo".
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
78 :date: Date. Returns a date in a Unix date format, including
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
79 the timezone: "Mon Sep 04 15:13:13 2006 0700".
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
80 :domain: Any text. Finds the first string that looks like an
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
81 email address, and extracts just the domain
9704
90e968899c72 help: markup email addresses as inline literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
82 component. Example: ``User <user@example.com>`` becomes
90e968899c72 help: markup email addresses as inline literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
83 ``example.com``.
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
84 :email: Any text. Extracts the first string that looks like
9704
90e968899c72 help: markup email addresses as inline literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
85 an email address. Example: ``User <user@example.com>``
90e968899c72 help: markup email addresses as inline literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
86 becomes ``user@example.com``.
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
87 :escape: Any text. Replaces the special XML/XHTML characters
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
88 "&", "<" and ">" with XML entities.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
89 :fill68: Any text. Wraps the text to fit in 68 columns.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
90 :fill76: Any text. Wraps the text to fit in 76 columns.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
91 :firstline: Any text. Returns the first line of text.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
92 :nonempty: Any text. Returns '(none)' if the string is empty.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
93 :hgdate: Date. Returns the date as a pair of numbers:
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
94 "1157407993 25200" (Unix timestamp, timezone offset).
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
95 :isodate: Date. Returns the date in ISO 8601 format:
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
96 "2009-08-18 13:00 +0200".
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
97 :isodatesec: Date. Returns the date in ISO 8601 format, including
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
98 seconds: "2009-08-18 13:00:13 +0200". See also the
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
99 rfc3339date filter.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
100 :localdate: Date. Converts a date to local date.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
101 :obfuscate: Any text. Returns the input text rendered as a
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
102 sequence of XML entities.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
103 :person: Any text. Returns the text before an email address.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
104 :rfc822date: Date. Returns a date using the same format used in
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
105 email headers: "Tue, 18 Aug 2009 13:00:13 +0200".
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
106 :rfc3339date: Date. Returns a date using the Internet date format
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
107 specified in RFC 3339: "2009-08-18T13:00:13+02:00".
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
108 :short: Changeset hash. Returns the short form of a changeset
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
109 hash, i.e. a 12-byte hexadecimal string.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
110 :shortdate: Date. Returns a date like "2006-09-18".
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
111 :strip: Any text. Strips all leading and trailing whitespace.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
112 :tabindent: Any text. Returns the text, with every line except
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
113 the first starting with a tab character.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
114 :urlescape: Any text. Escapes all "special" characters. For
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
115 example, "foo bar" becomes "foo%20bar".
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
116 :user: Any text. Returns the user portion of an email
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
117 address.