Browse Source

Merge "blame: Format commit and author only once per range"

stable-3.4
Shawn Pearce 11 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
62bbde3393
  1. 36
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java

36
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java

@ -222,19 +222,29 @@ class Blame extends TextBuiltin {
String authorFmt = MessageFormat.format(" (%-{0}s %{1}s", //$NON-NLS-1$ String authorFmt = MessageFormat.format(" (%-{0}s %{1}s", //$NON-NLS-1$
valueOf(authorWidth), valueOf(dateWidth)); valueOf(authorWidth), valueOf(dateWidth));
for (int line = begin; line < end; line++) { for (int line = begin; line < end;) {
outw.print(abbreviate(blame.getSourceCommit(line))); RevCommit c = blame.getSourceCommit(line);
if (showSourcePath) String commit = abbreviate(c);
outw.format(pathFmt, path(line)); String author = null;
if (showSourceLine) String date = null;
outw.format(numFmt, valueOf(blame.getSourceLine(line) + 1)); if (!noAuthor) {
if (!noAuthor) author = author(line);
outw.format(authorFmt, author(line), date(line)); date = date(line);
outw.format(lineFmt, valueOf(line + 1)); }
outw.flush(); do {
blame.getResultContents().writeLine(outs, line); outw.print(commit);
outs.flush(); if (showSourcePath)
outw.print('\n'); outw.format(pathFmt, path(line));
if (showSourceLine)
outw.format(numFmt, valueOf(blame.getSourceLine(line) + 1));
if (!noAuthor)
outw.format(authorFmt, author, date);
outw.format(lineFmt, valueOf(line + 1));
outw.flush();
blame.getResultContents().writeLine(outs, line);
outs.flush();
outw.print('\n');
} while (++line < end && blame.getSourceCommit(line) == c);
} }
} finally { } finally {
generator.release(); generator.release();

Loading…
Cancel
Save