##// END OF EJS Templates
annotate: add support for template keywords and functions depending on ctx
Yuya Nishihara -
r37000:66e64681 default
parent child Browse files
Show More
@@ -405,14 +405,15 b' def annotate(ui, repo, *pats, **opts):'
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')
@@ -71,6 +71,11 b' annotate (JSON)'
71 }
71 }
72 ]
72 ]
73
73
74 log-like templating
75
76 $ hg annotate -T'{lines % "{rev} {node|shortest}: {line}"}' a
77 0 8435: a
78
74 $ cat <<EOF >>a
79 $ cat <<EOF >>a
75 > a
80 > a
76 > a
81 > a
General Comments 0
You need to be logged in to leave comments. Login now