Example usage for org.eclipse.jgit.blame BlameResult computeAll

List of usage examples for org.eclipse.jgit.blame BlameResult computeAll

Introduction

In this page you can find the example usage for org.eclipse.jgit.blame BlameResult computeAll.

Prototype

public void computeAll() throws IOException 

Source Link

Document

Compute all pending information.

Usage

From source file:com.googlesource.gerrit.plugins.reviewersbyblame.ReviewersByBlame.java

License:Apache License

/**
 * Compute the blame data for the parent, we are not interested in the
 * specific commit but the parent, since we only want to know the last person
 * that edited this specific part of the code.
 *
 * @param entry {@link PatchListEntry}//w  ww . j av  a 2  s  . c o  m
 * @param commit Parent {@link RevCommit}
 * @return Result of blame computation, null if the computation fails
 */
private BlameResult computeBlame(final PatchListEntry entry, final RevCommit parent) {
    BlameCommand blameCommand = new BlameCommand(repo);
    blameCommand.setStartCommit(parent);
    blameCommand.setFilePath(entry.getNewName());
    try {
        BlameResult blameResult = blameCommand.call();
        blameResult.computeAll();
        return blameResult;
    } catch (GitAPIException ex) {
        log.error("Couldn't execute blame for commit {}", parent.getName(), ex);
    } catch (IOException err) {
        log.error("Error while computing blame for commit {}", parent.getName(), err);
    }
    return null;
}