# HG changeset patch # User Bryan O'Sullivan # Date 1240986791 25200 # Node ID 9e33729cafae2b062c58c52fe99bbc5bf0f6c9dc # Parent fd2e83ffb165a5b0b1fec777c7eaaca739b66f37 Add a multiline template example. diff -r fd2e83ffb165 -r 9e33729cafae en/ch10-template.xml --- a/en/ch10-template.xml Tue Apr 28 23:14:14 2009 -0700 +++ b/en/ch10-template.xml Tue Apr 28 23:33:11 2009 -0700 @@ -2,12 +2,12 @@ - Customising the output of Mercurial + Customizing the output of Mercurial Mercurial provides a powerful mechanism to let you control how it displays information. The mechanism is based on templates. You can use templates to generate specific output for a single - command, or to customise the entire appearance of the built-in web + command, or to customize the entire appearance of the built-in web interface. @@ -71,11 +71,11 @@ As I write this manual, these are so far the only commands that support styles and templates. Since these are the most - important commands that need customisable output, there has been + important commands that need customizable output, there has been little pressure from the Mercurial user community to add style and template support to other commands. + - The basics of templating @@ -186,12 +186,13 @@ tags: List of strings. Any tags associated with the changeset. - + + A few simple experiments will show us what to expect when we use these keywords; you can see the results below. -&interaction.template.simple.keywords; + &interaction.template.simple.keywords; As we noted above, the date keyword does not produce human-readable output, so we must treat it specially. This @@ -227,11 +228,11 @@ \v: Vertical tab, ASCII 13. - {: Open curly + \{: Open curly brace, {, ASCII 173. - }: Close curly + \}: Close curly brace, }, ASCII 175. @@ -408,7 +409,8 @@ example, Bryan O'Sullivan <bos@serpentine.com> becomes bos. - + + &interaction.template.simple.manyfilters; @@ -471,8 +473,8 @@ This tells Mercurial, if you're printing a changeset, use the text on the right as the template. + - Style file syntax @@ -564,7 +566,8 @@ clear (as in this case), but even when it is cryptic, it is almost always trivial to visually inspect the offending line in the style file and see what is wrong. - + + @@ -577,8 +580,8 @@ &interaction.template.svnstyle.id; - This is not guaranteed to be unique, but it is - nevertheless useful in many cases. + This is likely to be unique, and so it is + useful in many cases. There are a few caveats. It will not work in a completely empty repository, because such a repository does not have a @@ -600,7 +603,18 @@ Save this information away when you run an automated build or other activity, so that you can replay the build later if necessary. - + + + + + + Listing files on multiple lines + + Suppose we want to list the files changed by a changeset, + one per line, with a little indentation before each file + name. + + &interaction.ch10-multiline.go; diff -r fd2e83ffb165 -r 9e33729cafae en/examples/auto-snippets.xml --- a/en/examples/auto-snippets.xml Tue Apr 28 23:14:14 2009 -0700 +++ b/en/examples/auto-snippets.xml Tue Apr 28 23:33:11 2009 -0700 @@ -68,6 +68,7 @@ + diff -r fd2e83ffb165 -r 9e33729cafae en/examples/ch10/multiline --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/en/examples/ch10/multiline Tue Apr 28 23:33:11 2009 -0700 @@ -0,0 +1,13 @@ +#!/bin/sh + +hg init +echo a > test.c +hg ci -Am'First commit' + +#$ name: go + +cat > multiline << EOF +changeset = "Changed in {node|short}:\n{files}" +file = " {file}\n" +EOF +hg log --style multiline