help/templates.txt
author Martin Geisler <mg@lazybytes.net>
Sat, 24 Oct 2009 00:29:25 +0200
changeset 9636 926eba48eac9
parent 9540 cad36e496640
child 9704 90e968899c72
permissions -rw-r--r--
commands: search for translated version of "DEPRECATED" The option description is already translated at this point, so we must search for a translation of "DEPRECATED".
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    37
: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
    38
: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
    39
:node:      String. The changeset identification hash, as a
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    40
            40-character hexadecimal string.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    41
:parents:   List of strings. The parents of the changeset.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    42
:rev:       Integer. The repository-local changeset revision
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    43
            number.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    44
:tags:      List of strings. Any tags associated with the
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    45
            changeset.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    46
: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
    47
            changeset.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    48
: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
    49
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    50
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
    51
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
    52
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
    53
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
    54
output::
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    55
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    56
   $ hg tip --template "{date|isodate}\n"
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    57
   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
    58
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    59
List of filters:
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    60
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    61
: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
    62
              every line except the last.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    63
:age:         Date. Returns a human-readable date/time difference
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    64
              between the given date/time and the current
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    65
              date/time.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    66
: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
    67
              last component of the path after splitting by the
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    68
              path separator (ignoring trailing separators). For
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    69
              example, "foo/bar/baz" becomes "baz" and "foo/bar//"
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    70
              becomes "bar".
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    71
: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
    72
              if possible. For example, "foo" and "foo/bar" becomes
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    73
              "foo".
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    74
: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
    75
              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
    76
: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
    77
              email address, and extracts just the domain
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    78
              component. Example: 'User <user@example.com>' becomes
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    79
              'example.com'.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    80
:email:       Any text. Extracts the first string that looks like
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    81
              an email address. Example: 'User <user@example.com>'
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    82
              becomes 'user@example.com'.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    83
:escape:      Any text. Replaces the special XML/XHTML characters
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    84
              "&", "<" and ">" with XML entities.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    85
: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
    86
: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
    87
:firstline:   Any text. Returns the first line of text.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    88
: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
    89
: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
    90
              "1157407993 25200" (Unix timestamp, timezone offset).
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    91
:isodate:     Date. Returns the date in ISO 8601 format:
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    92
              "2009-08-18 13:00 +0200".
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    93
: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
    94
              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
    95
              rfc3339date filter.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    96
:localdate:   Date. Converts a date to local date.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    97
: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
    98
              sequence of XML entities.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    99
: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
   100
: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
   101
              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
   102
: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
   103
              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
   104
: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
   105
              hash, i.e. a 12-byte hexadecimal string.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
   106
:shortdate:   Date. Returns a date like "2006-09-18".
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
   107
:strip:       Any text. Strips all leading and trailing whitespace.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
   108
: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
   109
              the first starting with a tab character.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
   110
:urlescape:   Any text. Escapes all "special" characters. For
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
   111
              example, "foo bar" becomes "foo%20bar".
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
   112
: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
   113
              address.