comparison mercurial/commands.py @ 22705:d4869b280cd6

branches: include active, closed and current flags in template output
author Yuya Nishihara <yuya@tcha.org>
date Thu, 02 Oct 2014 23:26:02 +0900
parents 386339ffe421
children b17fd992d606
comparison
equal deleted inserted replaced
22704:386339ffe421 22705:d4869b280cd6
1114 label = 'branches.closed' 1114 label = 'branches.closed'
1115 notice = _(' (closed)') 1115 notice = _(' (closed)')
1116 else: 1116 else:
1117 label = 'branches.inactive' 1117 label = 'branches.inactive'
1118 notice = _(' (inactive)') 1118 notice = _(' (inactive)')
1119 if tag == repo.dirstate.branch(): 1119 current = (tag == repo.dirstate.branch())
1120 if current:
1120 label = 'branches.current' 1121 label = 'branches.current'
1121 1122
1122 fm.startitem() 1123 fm.startitem()
1123 fm.write('branch', '%s', tag, label=label) 1124 fm.write('branch', '%s', tag, label=label)
1124 rev = ctx.rev() 1125 rev = ctx.rev()
1125 padsize = max(31 - len(str(rev)) - encoding.colwidth(tag), 0) 1126 padsize = max(31 - len(str(rev)) - encoding.colwidth(tag), 0)
1126 fmt = ' ' * padsize + ' %d:%s' 1127 fmt = ' ' * padsize + ' %d:%s'
1127 fm.condwrite(not ui.quiet, 'rev node', fmt, rev, hexfunc(ctx.node()), 1128 fm.condwrite(not ui.quiet, 'rev node', fmt, rev, hexfunc(ctx.node()),
1128 label='log.changeset changeset.%s' % ctx.phasestr()) 1129 label='log.changeset changeset.%s' % ctx.phasestr())
1130 fm.data(active=isactive, closed=not isopen, current=current)
1129 if not ui.quiet: 1131 if not ui.quiet:
1130 fm.plain(notice) 1132 fm.plain(notice)
1131 fm.plain('\n') 1133 fm.plain('\n')
1132 fm.end() 1134 fm.end()
1133 1135