##// END OF EJS Templates
annotate: build format string separately from annotation data...
Yuya Nishihara -
r22477:3c8ae79e default
parent child Browse files
Show More
@@ -313,6 +313,7 b' def annotate(ui, repo, *pats, **opts):'
313
313
314 lines = fctx.annotate(follow=follow, linenumber=linenumber,
314 lines = fctx.annotate(follow=follow, linenumber=linenumber,
315 diffopts=diffopts)
315 diffopts=diffopts)
316 formats = []
316 pieces = []
317 pieces = []
317
318
318 for f, sep in funcmap:
319 for f, sep in funcmap:
@@ -320,11 +321,13 b' def annotate(ui, repo, *pats, **opts):'
320 if l:
321 if l:
321 sized = [(x, encoding.colwidth(x)) for x in l]
322 sized = [(x, encoding.colwidth(x)) for x in l]
322 ml = max([w for x, w in sized])
323 ml = max([w for x, w in sized])
323 pieces.append(["%s%s%s" % (sep, ' ' * (ml - w), x)
324 formats.append([sep + ' ' * (ml - w) + '%s'
324 for x, w in sized])
325 for x, w in sized])
325
326 pieces.append(l)
326 for p, l in zip(zip(*pieces), lines):
327
327 ui.write("%s: %s" % ("".join(p), l[1]))
328 for f, p, l in zip(zip(*formats), zip(*pieces), lines):
329 ui.write("".join(f) % p)
330 ui.write(": %s" % l[1])
328
331
329 if lines and not lines[-1][1].endswith('\n'):
332 if lines and not lines[-1][1].endswith('\n'):
330 ui.write('\n')
333 ui.write('\n')
General Comments 0
You need to be logged in to leave comments. Login now