comparison mercurial/commands.py @ 36988:66e64681e0a8

annotate: add support for template keywords and functions depending on ctx
author Yuya Nishihara <yuya@tcha.org>
date Sun, 11 Mar 2018 21:36:28 +0900
parents 66651ec259ea
children 1bf555cb680e
comparison
equal deleted inserted replaced
36987:939e0983c1d9 36988:66e64681e0a8
403 formats.append([sep + ' ' * (ml - w) + '%s' for w in sizes]) 403 formats.append([sep + ' ' * (ml - w) + '%s' for w in sizes])
404 else: 404 else:
405 formats.append(['%s' for x in l]) 405 formats.append(['%s' for x in l])
406 pieces.append(l) 406 pieces.append(l)
407 407
408 for f, p, l in zip(zip(*formats), zip(*pieces), lines): 408 for f, p, (n, l) in zip(zip(*formats), zip(*pieces), lines):
409 fm.startitem() 409 fm.startitem()
410 fm.context(fctx=n.fctx)
410 fm.write(fields, "".join(f), *p) 411 fm.write(fields, "".join(f), *p)
411 if l[0].skip: 412 if n.skip:
412 fmt = "* %s" 413 fmt = "* %s"
413 else: 414 else:
414 fmt = ": %s" 415 fmt = ": %s"
415 fm.write('line', fmt, l[1]) 416 fm.write('line', fmt, l)
416 417
417 if not lines[-1][1].endswith('\n'): 418 if not lines[-1][1].endswith('\n'):
418 fm.plain('\n') 419 fm.plain('\n')
419 fm.end() 420 fm.end()
420 421