eggs/mercurial-1.7.3-py2.6-linux-x86_64.egg/mercurial/help/templates.txt
changeset 69 c6bca38c1cbf
equal deleted inserted replaced
68:5ff1fc726848 69:c6bca38c1cbf
       
     1 Mercurial allows you to customize output of commands through
       
     2 templates. You can either pass in a template from the command
       
     3 line, via the --template option, or select an existing
       
     4 template-style (--style).
       
     5 
       
     6 You can customize output for any "log-like" command: log,
       
     7 outgoing, incoming, tip, parents, heads and glog.
       
     8 
       
     9 Four styles are packaged with Mercurial: default (the style used
       
    10 when no explicit preference is passed), compact, changelog,
       
    11 and xml.
       
    12 Usage::
       
    13 
       
    14     $ hg log -r1 --style changelog
       
    15 
       
    16 A template is a piece of text, with markup to invoke variable
       
    17 expansion::
       
    18 
       
    19     $ hg log -r1 --template "{node}\n"
       
    20     b56ce7b07c52de7d5fd79fb89701ea538af65746
       
    21 
       
    22 Strings in curly braces are called keywords. The availability of
       
    23 keywords depends on the exact context of the templater. These
       
    24 keywords are usually available for templating a log-like command:
       
    25 
       
    26 :author: String. The unmodified author of the changeset.
       
    27 
       
    28 :branches: List of strings. The name of the branch on which the
       
    29     changeset was committed. Will be empty if the branch name was
       
    30     default.
       
    31 
       
    32 :children: List of strings. The children of the changeset.
       
    33 
       
    34 :date: Date information. The date when the changeset was committed.
       
    35 
       
    36 :desc: String. The text of the changeset description.
       
    37 
       
    38 :diffstat: String. Statistics of changes with the following format:
       
    39     "modified files: +added/-removed lines"
       
    40 
       
    41 :files: List of strings. All files modified, added, or removed by this
       
    42     changeset.
       
    43 
       
    44 :file_adds: List of strings. Files added by this changeset.
       
    45 
       
    46 :file_copies: List of strings. Files copied in this changeset with
       
    47     their sources.
       
    48 
       
    49 :file_copies_switch: List of strings. Like "file_copies" but displayed
       
    50     only if the --copied switch is set.
       
    51 
       
    52 :file_mods: List of strings. Files modified by this changeset.
       
    53 
       
    54 :file_dels: List of strings. Files removed by this changeset.
       
    55 
       
    56 :node: String. The changeset identification hash, as a 40 hexadecimal
       
    57     digit string.
       
    58 
       
    59 :parents: List of strings. The parents of the changeset.
       
    60 
       
    61 :rev: Integer. The repository-local changeset revision number.
       
    62 
       
    63 :tags: List of strings. Any tags associated with the changeset.
       
    64 
       
    65 :latesttag: String. Most recent global tag in the ancestors of this
       
    66     changeset.
       
    67 
       
    68 :latesttagdistance: Integer. Longest path to the latest tag.
       
    69 
       
    70 The "date" keyword does not produce human-readable output. If you
       
    71 want to use a date in your output, you can use a filter to process
       
    72 it. Filters are functions which return a string based on the input
       
    73 variable. Be sure to use the stringify filter first when you're
       
    74 applying a string-input filter to a list-like input variable.
       
    75 You can also use a chain of filters to get the desired output::
       
    76 
       
    77    $ hg tip --template "{date|isodate}\n"
       
    78    2008-08-21 18:22 +0000
       
    79 
       
    80 List of filters:
       
    81 
       
    82 :addbreaks: Any text. Add an XHTML "<br />" tag before the end of
       
    83     every line except the last.
       
    84 
       
    85 :age: Date. Returns a human-readable date/time difference between the
       
    86     given date/time and the current date/time.
       
    87 
       
    88 :basename: Any text. Treats the text as a path, and returns the last
       
    89     component of the path after splitting by the path separator
       
    90     (ignoring trailing separators). For example, "foo/bar/baz" becomes
       
    91     "baz" and "foo/bar//" becomes "bar".
       
    92 
       
    93 :stripdir: Treat the text as path and strip a directory level, if
       
    94     possible. For example, "foo" and "foo/bar" becomes "foo".
       
    95 
       
    96 :date: Date. Returns a date in a Unix date format, including the
       
    97     timezone: "Mon Sep 04 15:13:13 2006 0700".
       
    98 
       
    99 :domain: Any text. Finds the first string that looks like an email
       
   100     address, and extracts just the domain component. Example: ``User
       
   101     <user@example.com>`` becomes ``example.com``.
       
   102 
       
   103 :email: Any text. Extracts the first string that looks like an email
       
   104     address. Example: ``User <user@example.com>`` becomes
       
   105     ``user@example.com``.
       
   106 
       
   107 :escape: Any text. Replaces the special XML/XHTML characters "&", "<"
       
   108     and ">" with XML entities.
       
   109 
       
   110 :hex: Any text. Convert a binary Mercurial node identifier into
       
   111     its long hexadecimal representation.
       
   112 
       
   113 :fill68: Any text. Wraps the text to fit in 68 columns.
       
   114 
       
   115 :fill76: Any text. Wraps the text to fit in 76 columns.
       
   116 
       
   117 :firstline: Any text. Returns the first line of text.
       
   118 
       
   119 :nonempty: Any text. Returns '(none)' if the string is empty.
       
   120 
       
   121 :hgdate: Date. Returns the date as a pair of numbers: "1157407993
       
   122     25200" (Unix timestamp, timezone offset).
       
   123 
       
   124 :isodate: Date. Returns the date in ISO 8601 format: "2009-08-18 13:00
       
   125     +0200".
       
   126 
       
   127 :isodatesec: Date. Returns the date in ISO 8601 format, including
       
   128     seconds: "2009-08-18 13:00:13 +0200". See also the rfc3339date
       
   129     filter.
       
   130 
       
   131 :localdate: Date. Converts a date to local date.
       
   132 
       
   133 :obfuscate: Any text. Returns the input text rendered as a sequence of
       
   134     XML entities.
       
   135 
       
   136 :person: Any text. Returns the text before an email address.
       
   137 
       
   138 :rfc822date: Date. Returns a date using the same format used in email
       
   139     headers: "Tue, 18 Aug 2009 13:00:13 +0200".
       
   140 
       
   141 :rfc3339date: Date. Returns a date using the Internet date format
       
   142     specified in RFC 3339: "2009-08-18T13:00:13+02:00".
       
   143 
       
   144 :short: Changeset hash. Returns the short form of a changeset hash,
       
   145     i.e. a 12 hexadecimal digit string.
       
   146 
       
   147 :shortdate: Date. Returns a date like "2006-09-18".
       
   148 
       
   149 :stringify: Any type. Turns the value into text by converting values into
       
   150     text and concatenating them.
       
   151 
       
   152 :strip: Any text. Strips all leading and trailing whitespace.
       
   153 
       
   154 :tabindent: Any text. Returns the text, with every line except the
       
   155      first starting with a tab character.
       
   156 
       
   157 :urlescape: Any text. Escapes all "special" characters. For example,
       
   158     "foo bar" becomes "foo%20bar".
       
   159 
       
   160 :user: Any text. Returns the user portion of an email address.