List of usage examples for org.eclipse.jgit.blame BlameResult computeNext
public int computeNext() throws IOException
From source file:org.apache.maven.scm.provider.git.jgit.command.blame.JGitBlameCommand.java
License:Apache License
@Override public BlameScmResult executeBlameCommand(ScmProviderRepository repo, ScmFileSet workingDirectory, String filename) throws ScmException { Git git = null;/* ww w . j av a 2s. co m*/ File basedir = workingDirectory.getBasedir(); try { git = Git.open(basedir); BlameResult blameResult = git.blame().setFilePath(filename).call(); List<BlameLine> lines = new ArrayList<BlameLine>(); int i = 0; while ((i = blameResult.computeNext()) != -1) { lines.add(new BlameLine(blameResult.getSourceAuthor(i).getWhen(), blameResult.getSourceCommit(i).getName(), blameResult.getSourceAuthor(i).getName(), blameResult.getSourceCommitter(i).getName())); } return new BlameScmResult("JGit blame", lines); } catch (Exception e) { throw new ScmException("JGit blame failure!", e); } finally { JGitUtils.closeRepo(git); } }