comparison mercurial/help.py @ 9294:5f4862a00697

help: format templating help topic with a field list
author Martin Geisler <mg@lazybytes.net>
date Sun, 02 Aug 2009 23:38:08 +0200
parents 26fb5b0a4424
children b0f447a259ab
comparison
equal deleted inserted replaced
9293:e48a48b754d3 9294:5f4862a00697
373 373
374 Strings in curly braces are called keywords. The availability of 374 Strings in curly braces are called keywords. The availability of
375 keywords depends on the exact context of the templater. These 375 keywords depends on the exact context of the templater. These
376 keywords are usually available for templating a log-like command: 376 keywords are usually available for templating a log-like command:
377 377
378 - author: String. The unmodified author of the changeset. 378 :author: String. The unmodified author of the changeset.
379 - branches: String. The name of the branch on which the changeset 379 :branches: String. The name of the branch on which the changeset
380 was committed. Will be empty if the branch name was default. 380 was committed. Will be empty if the branch name was
381 - date: Date information. The date when the changeset was 381 default.
382 committed. 382 :date: Date information. The date when the changeset was
383 - desc: String. The text of the changeset description. 383 committed.
384 - diffstat: String. Statistics of changes with the following 384 :desc: String. The text of the changeset description.
385 format: "modified files: +added/-removed lines" 385 :diffstat: String. Statistics of changes with the following
386 - files: List of strings. All files modified, added, or removed by 386 format: "modified files: +added/-removed lines"
387 this changeset. 387 :files: List of strings. All files modified, added, or removed
388 - file_adds: List of strings. Files added by this changeset. 388 by this changeset.
389 - file_mods: List of strings. Files modified by this changeset. 389 :file_adds: List of strings. Files added by this changeset.
390 - file_dels: List of strings. Files removed by this changeset. 390 :file_mods: List of strings. Files modified by this changeset.
391 - node: String. The changeset identification hash, as a 391 :file_dels: List of strings. Files removed by this changeset.
392 40-character hexadecimal string. 392 :node: String. The changeset identification hash, as a
393 - parents: List of strings. The parents of the changeset. 393 40-character hexadecimal string.
394 - rev: Integer. The repository-local changeset revision number. 394 :parents: List of strings. The parents of the changeset.
395 - tags: List of strings. Any tags associated with the changeset. 395 :rev: Integer. The repository-local changeset revision
396 number.
397 :tags: List of strings. Any tags associated with the
398 changeset.
396 399
397 The "date" keyword does not produce human-readable output. If you 400 The "date" keyword does not produce human-readable output. If you
398 want to use a date in your output, you can use a filter to process 401 want to use a date in your output, you can use a filter to process
399 it. Filters are functions which return a string based on the input 402 it. Filters are functions which return a string based on the input
400 variable. You can also use a chain of filters to get the desired 403 variable. You can also use a chain of filters to get the desired
403 $ hg tip --template "{date|isodate}\n" 406 $ hg tip --template "{date|isodate}\n"
404 2008-08-21 18:22 +0000 407 2008-08-21 18:22 +0000
405 408
406 List of filters: 409 List of filters:
407 410
408 - addbreaks: Any text. Add an XHTML "<br />" tag before the end of 411 :addbreaks: Any text. Add an XHTML "<br />" tag before the end of
409 every line except the last. 412 every line except the last.
410 - age: Date. Returns a human-readable date/time difference between 413 :age: Date. Returns a human-readable date/time difference
411 the given date/time and the current date/time. 414 between the given date/time and the current
412 - basename: Any text. Treats the text as a path, and returns the 415 date/time.
413 last component of the path after splitting by the path separator 416 :basename: Any text. Treats the text as a path, and returns the
414 (ignoring trailing separators). For example, "foo/bar/baz" 417 last component of the path after splitting by the
415 becomes "baz" and "foo/bar//" becomes "bar". 418 path separator (ignoring trailing separators). For
416 - stripdir: Treat the text as path and strip a directory level, if 419 example, "foo/bar/baz" becomes "baz" and "foo/bar//"
417 possible. For example, "foo" and "foo/bar" becomes "foo". 420 becomes "bar".
418 - date: Date. Returns a date in a Unix date format, including the 421 :stripdir: Treat the text as path and strip a directory level,
419 timezone: "Mon Sep 04 15:13:13 2006 0700". 422 if possible. For example, "foo" and "foo/bar" becomes
420 - domain: Any text. Finds the first string that looks like an 423 "foo".
421 email address, and extracts just the domain component. Example: 424 :date: Date. Returns a date in a Unix date format, including
422 'User <user@example.com>' becomes 'example.com'. 425 the timezone: "Mon Sep 04 15:13:13 2006 0700".
423 - email: Any text. Extracts the first string that looks like an 426 :domain: Any text. Finds the first string that looks like an
424 email address. Example: 'User <user@example.com>' becomes 427 email address, and extracts just the domain
425 'user@example.com'. 428 component. Example: 'User <user@example.com>' becomes
426 - escape: Any text. Replaces the special XML/XHTML characters "&", 429 'example.com'.
427 "<" and ">" with XML entities. 430 :email: Any text. Extracts the first string that looks like
428 - fill68: Any text. Wraps the text to fit in 68 columns. 431 an email address. Example: 'User <user@example.com>'
429 - fill76: Any text. Wraps the text to fit in 76 columns. 432 becomes 'user@example.com'.
430 - firstline: Any text. Returns the first line of text. 433 :escape: Any text. Replaces the special XML/XHTML characters
431 - nonempty: Any text. Returns '(none)' if the string is empty. 434 "&", "<" and ">" with XML entities.
432 - hgdate: Date. Returns the date as a pair of numbers: "1157407993 435 :fill68: Any text. Wraps the text to fit in 68 columns.
433 25200" (Unix timestamp, timezone offset). 436 :fill76: Any text. Wraps the text to fit in 76 columns.
434 - isodate: Date. Returns the date in ISO 8601 format. 437 :firstline: Any text. Returns the first line of text.
435 - localdate: Date. Converts a date to local date. 438 :nonempty: Any text. Returns '(none)' if the string is empty.
436 - obfuscate: Any text. Returns the input text rendered as a 439 :hgdate: Date. Returns the date as a pair of numbers:
437 sequence of XML entities. 440 "1157407993 25200" (Unix timestamp, timezone offset).
438 - person: Any text. Returns the text before an email address. 441 :isodate: Date. Returns the date in ISO 8601 format.
439 - rfc822date: Date. Returns a date using the same format used in 442 :localdate: Date. Converts a date to local date.
440 email headers. 443 :obfuscate: Any text. Returns the input text rendered as a
441 - short: Changeset hash. Returns the short form of a changeset 444 sequence of XML entities.
442 hash, i.e. a 12-byte hexadecimal string. 445 :person: Any text. Returns the text before an email address.
443 - shortdate: Date. Returns a date like "2006-09-18". 446 :rfc822date: Date. Returns a date using the same format used in
444 - strip: Any text. Strips all leading and trailing whitespace. 447 email headers.
445 - tabindent: Any text. Returns the text, with every line except 448 :short: Changeset hash. Returns the short form of a changeset
446 the first starting with a tab character. 449 hash, i.e. a 12-byte hexadecimal string.
447 - urlescape: Any text. Escapes all "special" characters. For 450 :shortdate: Date. Returns a date like "2006-09-18".
448 example, "foo bar" becomes "foo%20bar". 451 :strip: Any text. Strips all leading and trailing whitespace.
449 - user: Any text. Returns the user portion of an email address. 452 :tabindent: Any text. Returns the text, with every line except
453 the first starting with a tab character.
454 :urlescape: Any text. Escapes all "special" characters. For
455 example, "foo bar" becomes "foo%20bar".
456 :user: Any text. Returns the user portion of an email
457 address.
450 ''')), 458 ''')),
451 459
452 (['urls'], _('URL Paths'), 460 (['urls'], _('URL Paths'),
453 _(r''' 461 _(r'''
454 Valid URLs are of the form:: 462 Valid URLs are of the form::