Online Book Reader

Home Category

Mercurial_ The Definitive Guide - Bryan O'Sullivan [87]

By Root 957 0
any trailing newlines.

hgdate: date keyword. Render the date as a pair of readable numbers. Yields a string like 1157407993 25200.

isodate: date keyword. Render the date as a text string in ISO 8601 format. Yields a string like 2006-09-04 15:13:13 -0700.

obfuscate: Any text, but most useful for the author keyword. Yields the input text rendered as a sequence of XML entities. This helps to defeat some particularly stupid screen-scraping email harvesting spambots.

person: Any text, but most useful for the author keyword. Yields the text before an email address. For example, Bryan O’Sullivan becomes Bryan O’Sullivan.

rfc822date: date keyword. Render a date using the same format used in email headers. Yields a string like Mon, 04 Sep 2006 15:13:13 -0700.

short: Changeset hash. Yields the short form of a changeset hash, i.e., a 12-character hexadecimal string.

shortdate: date keyword. Render the year, month, and day of the date. Yields a string like 2006-09-04.

strip: Any text. Strip all leading and trailing whitespace from the string.

tabindent: Any text. Yields the text, with every line except the first starting with a tab character.

urlescape: Any text. Escape all characters that are considered “special” by URL parsers. For example, foo bar becomes foo%20bar.

user: Any text, but most useful for the author keyword. Return the “user” portion of an email address. For example, Bryan O’Sullivan becomes bos.$ hg log -r1 --template '{author}\n'

Bryan O'Sullivan

$ hg log -r1 --template '{author|domain}\n'

serpentine.com

$ hg log -r1 --template '{author|email}\n'

bos@serpentine.com

$ hg log -r1 --template '{author|obfuscate}\n' | cut -c-76

Bryan O'Sulli

$ hg log -r1 --template '{author|person}\n'

Bryan O'Sullivan

$ hg log -r1 --template '{author|user}\n'

bos

$ hg log -r1 --template 'looks almost right, but actually garbage: {date}\n'

looks almost right, but actually garbage: 1241505885.00

$ hg log -r1 --template '{date|age}\n'

1 second

$ hg log -r1 --template '{date|date}\n'

Tue May 05 06:44:45 2009 +0000

$ hg log -r1 --template '{date|hgdate}\n'

1241505885 0

$ hg log -r1 --template '{date|isodate}\n'

2009-05-05 06:44 +0000

$ hg log -r1 --template '{date|rfc822date}\n'

Tue, 05 May 2009 06:44:45 +0000

$ hg log -r1 --template '{date|shortdate}\n'

2009-05-05

$ hg log -r1 --template '{desc}\n' | cut -c-76

added line to end of <> file.

in addition, added a file with the helpful name (at least i hope that some m

$ hg log -r1 --template '{desc|addbreaks}\n' | cut -c-76

added line to end of <> file.


in addition, added a file with the helpful name (at least i hope that some m

$ hg log -r1 --template '{desc|escape}\n' | cut -c-76

added line to end of <<hello>> file.

in addition, added a file with the helpful name (at least i hope that some m

$ hg log -r1 --template '{desc|fill68}\n'

added line to end of <> file.

in addition, added a file with the helpful name (at least i hope

that some might consider it so) of goodbye.

$ hg log -r1 --template '{desc|fill76}\n'

added line to end of <> file.

in addition, added a file with the helpful name (at least i hope that some

might consider it so) of goodbye.

$ hg log -r1 --template '{desc|firstline}\n'

added line to end of <> file.

$ hg log -r1 --template '{desc|strip}\n' | cut -c-76

added line to end of <> file.

in addition, added a file with the helpful name (at least i hope that some m

$ hg log -r1 --template '{desc|tabindent}\n' | expand | cut -c-76

added line to end of <> file.

in addition, added a file with the helpful name (at least i hope tha

$ hg log -r1 --template '{node}\n'

59ae2fd35d8a09c1532bf5ecd9035b4ac6db2cda

$ hg log -r1 --template '{node|short}\n'

59ae2fd35d8a

* * *

Warning


If you try to apply a filter to a piece of data that it cannot process, Mercurial will fail and print a Python exception. For example,

Return Main Page Previous Page Next Page

®Online Book Reader