[PATCH] template: add showbranch template for {branch}

Greg Ward greg-hg at gerg.ca
Mon Dec 13 11:55:39 CST 2010


On Mon, Dec 13, 2010 at 10:30 AM, Eric Eisner <ede at mit.edu> wrote:
> # HG changeset patch
> # User Eric Eisner <ede at mit.edu>
> # Date 1292254215 18000
> # Node ID 24e67dc52c257db32a3322f6784a0ad8e9cb42d0
> # Parent  bf763946f8b09fd23aa7835f44c8699998a8c389
> template: add showbranch template for {branch}
>
> Like showbranches, but always yields exactly one branch. Replaces the less
> correct {branches|nonempty}.

+1!!

I wrote this exact patch myself a few weeks ago, but didn't bother
with tests and hadn't gotten around to sending it in.  Thank you for
doing it right, Eric!

Here's why I want this: I would like to be able to run

  $ hg log --template "{node|short}  {branch}  {desc|firstline}\n"

fairly regularly.  Currently I kludge it with

  $ hg log --template "{node|short}  '{branches}'  {desc|firstline}\n"

where I just know that '' means 'default'.  Blech.  This is very weird
and obscure, and hostile to piping the results to awk or grep or
whatever.

Greg


More information about the Mercurial-devel mailing list