Mercurial > hg-stable
changeset 32671:d3d262ff42c0
annotate: rename formatter variable
So we can add a nested 'fm' of narrow scope.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 03 Jun 2017 00:05:12 +0900 |
parents | 331dcf199039 |
children | 7a209737f01c |
files | mercurial/commands.py |
diffstat | 1 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sun May 07 23:29:03 2017 -0400 +++ b/mercurial/commands.py Sat Jun 03 00:05:12 2017 +0900 @@ -299,7 +299,7 @@ ctx = scmutil.revsingle(repo, opts.get('rev')) - fm = ui.formatter('annotate', opts) + rootfm = ui.formatter('annotate', opts) if ui.quiet: datefunc = util.shortdate else: @@ -309,7 +309,7 @@ if node is None: return None else: - return fm.hexfunc(node) + return rootfm.hexfunc(node) if opts.get('changeset'): # omit "+" suffix which is appended to node hex def formatrev(rev): @@ -325,11 +325,11 @@ return '%d ' % rev def formathex(hex): if hex is None: - return '%s+' % fm.hexfunc(ctx.p1().node()) + return '%s+' % rootfm.hexfunc(ctx.p1().node()) else: return '%s ' % hex else: - hexfn = fm.hexfunc + hexfn = rootfm.hexfunc formatrev = formathex = str opmap = [('user', ' ', lambda x: x[0].user(), ui.shortuser), @@ -351,7 +351,7 @@ ui.pager('annotate') - if fm.isplain(): + if rootfm.isplain(): def makefunc(get, fmt): return lambda x: fmt(get(x)) else: @@ -378,9 +378,11 @@ for abs in ctx.walk(m): fctx = ctx[abs] if not opts.get('text') and fctx.isbinary(): - fm.plain(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs)) + rootfm.plain(_("%s: binary file\n") + % ((pats and m.rel(abs)) or abs)) continue + fm = rootfm lines = fctx.annotate(follow=follow, linenumber=linenumber, skiprevs=skiprevs, diffopts=diffopts) if not lines: @@ -406,7 +408,7 @@ if not lines[-1][1].endswith('\n'): fm.plain('\n') - fm.end() + rootfm.end() @command('archive', [('', 'no-decode', None, _('do not pass files through decoders')),