[PATCH] update templates doc to better explain the default style

Matt Mackall mpm at selenic.com
Mon Oct 3 12:46:45 CDT 2011

On Mon, 2011-10-03 at 16:14 +0000, Haszlakiewicz, Eric wrote:
> Here's a slight clarification to how the --style option works, and a pointer to the most up to date info (since this ends up in relatively static hg.1 man page):
> diff --git a/mercurial/help/templates.txt b/mercurial/help/templates.txt
> --- mercurial/help/templates.txt
> +++ mercurial/help/templates.txt
> @@ -13,6 +13,15 @@
>      $ hg log -r1 --style changelog
> +The --style option can specify an explicit filename, or the name of
> +a pre-installed style.  The pre-installed styles are located in
> +<install-dir>/lib/python<version>/site-packages/mercurial/templates/map-cmdline.<style>

Except when it's not. Which is probably the case on Windows. And on
systems with lib64, and /usr/shared/pyshared, and when there are
multiple copies installed, etc..

I think we should have some way of reporting where Mercurial thinks the
templates are and then document it here.

> +However, for performance reasons the map-cmdline.default style file is only
> +present for reference, as a compiled in default is used when --style is not
> +specified.  You can force the non-compiled-in default to be used by specifying
> +--style default.

Well, that's not strictly correct. When no style is specified, we don't
use a template at all. 

But you're right, the 'default' style is apparently just as, well, a
template, and tweaking it won't actually change the default appearance.
This might be better addressed with a comment in that file.

>  A template is a piece of text, with markup to invoke variable
>  expansion::
> @@ -22,6 +31,7 @@
>  Strings in curly braces are called keywords. The availability of
>  keywords depends on the exact context of the templater. These
>  keywords are usually available for templating a log-like command:
> +(See the output of "hg help templates" for a more up-to-date list.)


This -is- the output of 'hg help templates'?

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial-devel mailing list