Show More
@@ -469,26 +469,27 b' def annotate(ui, repo, *pats, **opts):' | |||||
469 |
|
469 | |||
470 | lines = fctx.annotate(follow=follow, linenumber=linenumber, |
|
470 | lines = fctx.annotate(follow=follow, linenumber=linenumber, | |
471 | diffopts=diffopts) |
|
471 | diffopts=diffopts) | |
|
472 | if not lines: | |||
|
473 | continue | |||
472 | formats = [] |
|
474 | formats = [] | |
473 | pieces = [] |
|
475 | pieces = [] | |
474 |
|
476 | |||
475 | for f, sep in funcmap: |
|
477 | for f, sep in funcmap: | |
476 | l = [f(n) for n, dummy in lines] |
|
478 | l = [f(n) for n, dummy in lines] | |
477 |
if |
|
479 | if fm: | |
478 | if fm: |
|
480 | formats.append(['%s' for x in l]) | |
479 | formats.append(['%s' for x in l]) |
|
481 | else: | |
480 | else: |
|
482 | sizes = [encoding.colwidth(x) for x in l] | |
481 | sizes = [encoding.colwidth(x) for x in l] |
|
483 | ml = max(sizes) | |
482 | ml = max(sizes) |
|
484 | formats.append([sep + ' ' * (ml - w) + '%s' for w in sizes]) | |
483 | formats.append([sep + ' ' * (ml - w) + '%s' for w in sizes]) |
|
485 | pieces.append(l) | |
484 | pieces.append(l) |
|
|||
485 |
|
486 | |||
486 | for f, p, l in zip(zip(*formats), zip(*pieces), lines): |
|
487 | for f, p, l in zip(zip(*formats), zip(*pieces), lines): | |
487 | fm.startitem() |
|
488 | fm.startitem() | |
488 | fm.write(fields, "".join(f), *p) |
|
489 | fm.write(fields, "".join(f), *p) | |
489 | fm.write('line', ": %s", l[1]) |
|
490 | fm.write('line', ": %s", l[1]) | |
490 |
|
491 | |||
491 |
if |
|
492 | if not lines[-1][1].endswith('\n'): | |
492 | fm.plain('\n') |
|
493 | fm.plain('\n') | |
493 |
|
494 | |||
494 | fm.end() |
|
495 | fm.end() |
General Comments 0
You need to be logged in to leave comments.
Login now