Mercurial > public > mercurial-scm > hg-stable
diff mercurial/templatekw.py @ 13156:d79fdff55627
template: add showbranch template for {branch}
Like showbranches, but always yields exactly one branch. Replaces the less
correct {branches|nonempty}.
author | Eric Eisner <ede@mit.edu> |
---|---|
date | Mon, 13 Dec 2010 10:30:15 -0500 |
parents | 8f29a08e7bbc |
children | f78bc5ddbe4f |
line wrap: on
line diff
--- a/mercurial/templatekw.py Mon Nov 29 09:37:23 2010 +0100 +++ b/mercurial/templatekw.py Mon Dec 13 10:30:15 2010 -0500 @@ -145,6 +145,9 @@ def showauthor(repo, ctx, templ, **args): return ctx.user() +def showbranch(**args): + return args['ctx'].branch() + def showbranches(**args): branch = args['ctx'].branch() if branch != 'default': @@ -247,6 +250,7 @@ # revcache - a cache dictionary for the current revision keywords = { 'author': showauthor, + 'branch': showbranch, 'branches': showbranches, 'children': showchildren, 'date': showdate,