changeset 31183:052e4f1ffce9

branches: populate all template keywords in formatter This is a usage example of fm.context().
author Yuya Nishihara <yuya@tcha.org>
date Sat, 25 Feb 2017 17:08:42 +0900
parents 16272d8c24f6
children 842489d18118
files mercurial/commands.py tests/test-branches.t
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Feb 25 17:00:07 2017 +0900
+++ b/mercurial/commands.py	Sat Feb 25 17:08:42 2017 +0900
@@ -1258,6 +1258,7 @@
         fmt = ' ' * padsize + ' %d:%s'
         fm.condwrite(not ui.quiet, 'rev node', fmt, rev, hexfunc(ctx.node()),
                      label='log.changeset changeset.%s' % ctx.phasestr())
+        fm.context(ctx=ctx)
         fm.data(active=isactive, closed=not isopen, current=current)
         if not ui.quiet:
             fm.plain(notice)
--- a/tests/test-branches.t	Sat Feb 25 17:00:07 2017 +0900
+++ b/tests/test-branches.t	Sat Feb 25 17:08:42 2017 +0900
@@ -519,6 +519,12 @@
   $ hg branches --closed -T '{if(closed, "{branch}\n")}'
   c
 
+  $ hg branches -T '{word(0, branch)}: {desc|firstline}\n'
+  b: reopen branch with a change
+  a: Adding d branch
+  a: Adding b branch head 2
+  default: Adding root node
+
 Tests of revision branch name caching
 
 We rev branch cache is updated automatically. In these tests we use a trick to