templater: makes branches work correctly with stringify (issue4108) stable
authorMatt Mackall <mpm@selenic.com>
Thu, 21 Nov 2013 11:30:52 -0600
branchstable
changeset 20076 faa4b3fc4197
parent 20071 4778f398ec83
child 20079 d4838302305c
child 20092 77acd8ce01ce
templater: makes branches work correctly with stringify (issue4108)
mercurial/templatekw.py
tests/test-command-template.t
--- a/mercurial/templatekw.py	Sun Nov 17 15:11:09 2013 -0800
+++ b/mercurial/templatekw.py	Thu Nov 21 11:30:52 2013 -0600
@@ -188,6 +188,7 @@
     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
--- a/tests/test-command-template.t	Sun Nov 17 15:11:09 2013 -0800
+++ b/tests/test-command-template.t	Thu Nov 21 11:30:52 2013 -0600
@@ -1606,3 +1606,8 @@
   {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