# HG changeset patch # User Yuya Nishihara # Date 2017-02-25 08:08:42 # Node ID 052e4f1ffce964ffae6333aec4883ef2b4080e4f # Parent 16272d8c24f6584b2d4da241ceee66e9f37ebb66 branches: populate all template keywords in formatter This is a usage example of fm.context(). diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1258,6 +1258,7 @@ def branches(ui, repo, active=False, clo 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) diff --git a/tests/test-branches.t b/tests/test-branches.t --- a/tests/test-branches.t +++ b/tests/test-branches.t @@ -519,6 +519,12 @@ template output: $ 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