/** * Compute the next available segment and return the first index. * <p> * Computes one segment and returns to the caller the first index that is * available. After return the caller can also inspect {@link #lastLength()} * to determine how many lines of the result were computed. * * @return index that is now available. -1 if no more are available. * @throws java.io.IOException * the repository cannot be read. */ public int computeNext() throws IOException { BlameGenerator gen = generator; if (gen == null) return -1; if (gen.next()) { loadFrom(gen); lastLength = gen.getRegionLength(); return gen.getResultStart(); } else { gen.close(); generator = null; return -1; } }
private void loadFrom(BlameGenerator gen) { RevCommit srcCommit = gen.getSourceCommit(); PersonIdent srcAuthor = gen.getSourceAuthor(); PersonIdent srcCommitter = gen.getSourceCommitter(); String srcPath = gen.getSourcePath(); int srcLine = gen.getSourceStart(); int resLine = gen.getResultStart(); int resEnd = gen.getResultEnd(); for (; resLine < resEnd; resLine++) { // Reverse blame can generate multiple results for the same line. // Favor the first one selected, as this is the oldest and most // likely to be nearest to the inquiry made by the user. if (sourceLines[resLine] != 0) continue; sourceCommits[resLine] = srcCommit; sourceAuthors[resLine] = srcAuthor; sourceCommitters[resLine] = srcCommitter; sourcePaths[resLine] = srcPath; // Since sourceLines is 1-based to permit hasSourceData to use 0 to // mean the line has not been annotated yet, pre-increment instead // of the traditional post-increment when making the assignment. sourceLines[resLine] = ++srcLine; } } }
int resLine = gen.getResultStart(); int resEnd = gen.getResultEnd();
/** * Compute the next available segment and return the first index. * <p> * Computes one segment and returns to the caller the first index that is * available. After return the caller can also inspect {@link #lastLength()} * to determine how many lines of the result were computed. * * @return index that is now available. -1 if no more are available. * @throws java.io.IOException * the repository cannot be read. */ public int computeNext() throws IOException { BlameGenerator gen = generator; if (gen == null) return -1; if (gen.next()) { loadFrom(gen); lastLength = gen.getRegionLength(); return gen.getResultStart(); } else { gen.close(); generator = null; return -1; } }
/** * Compute the next available segment and return the first index. * <p> * Computes one segment and returns to the caller the first index that is * available. After return the caller can also inspect {@link #lastLength()} * to determine how many lines of the result were computed. * * @return index that is now available. -1 if no more are available. * @throws IOException * the repository cannot be read. */ public int computeNext() throws IOException { BlameGenerator gen = generator; if (gen == null) return -1; if (gen.next()) { loadFrom(gen); lastLength = gen.getRegionLength(); return gen.getResultStart(); } else { gen.close(); generator = null; return -1; } }
private void loadFrom(BlameGenerator gen) { RevCommit srcCommit = gen.getSourceCommit(); PersonIdent srcAuthor = gen.getSourceAuthor(); PersonIdent srcCommitter = gen.getSourceCommitter(); String srcPath = gen.getSourcePath(); int srcLine = gen.getSourceStart(); int resLine = gen.getResultStart(); int resEnd = gen.getResultEnd(); for (; resLine < resEnd; resLine++) { // Reverse blame can generate multiple results for the same line. // Favor the first one selected, as this is the oldest and most // likely to be nearest to the inquiry made by the user. if (sourceLines[resLine] != 0) continue; sourceCommits[resLine] = srcCommit; sourceAuthors[resLine] = srcAuthor; sourceCommitters[resLine] = srcCommitter; sourcePaths[resLine] = srcPath; // Since sourceLines is 1-based to permit hasSourceData to use 0 to // mean the line has not been annotated yet, pre-increment instead // of the traditional post-increment when making the assignment. sourceLines[resLine] = ++srcLine; } } }
private void loadFrom(BlameGenerator gen) { RevCommit srcCommit = gen.getSourceCommit(); PersonIdent srcAuthor = gen.getSourceAuthor(); PersonIdent srcCommitter = gen.getSourceCommitter(); String srcPath = gen.getSourcePath(); int srcLine = gen.getSourceStart(); int resLine = gen.getResultStart(); int resEnd = gen.getResultEnd(); for (; resLine < resEnd; resLine++) { // Reverse blame can generate multiple results for the same line. // Favor the first one selected, as this is the oldest and most // likely to be nearest to the inquiry made by the user. if (sourceLines[resLine] != 0) continue; sourceCommits[resLine] = srcCommit; sourceAuthors[resLine] = srcAuthor; sourceCommitters[resLine] = srcCommitter; sourcePaths[resLine] = srcPath; // Since sourceLines is 1-based to permit hasSourceData to use 0 to // mean the line has not been annotated yet, pre-increment instead // of the traditional post-increment when making the assignment. sourceLines[resLine] = ++srcLine; } } }
int resLine = gen.getResultStart(); int resEnd = gen.getResultEnd();
int resLine = gen.getResultStart(); int resEnd = gen.getResultEnd();