# HG changeset patch # User Matt Mackall # Date 2013-11-21 17:30:52 # Node ID faa4b3fc4197e5ba6a6051adf5632bfd39ad5b9d # Parent 4778f398ec83274fff9db1117f6cc75d6437eeef templater: makes branches work correctly with stringify (issue4108) diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -188,6 +188,7 @@ def showbranches(**args): branch = args['ctx'].branch() if branch != 'default': return showlist('branch', [branch], plural='branches', **args) + return showlist('branch', [], plural='branches', **args) def showbookmarks(**args): """:bookmarks: List of strings. Any bookmarks associated with the diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -1606,3 +1606,8 @@ Test recursive evaluation: {rev} $ hg log -r 0 --template '{if(rev, "{author} {rev}")}\n' test 0 + +Test branches inside if statement: + + $ hg log -r 0 --template '{if(branches, "yes", "no")}\n' + no