use of org.eclipse.jgit.revplot.PlotCommitList in project gitblit by gitblit.
the class JGitUtilsTest method testPlots.
@Test
public void testPlots() throws Exception {
Repository repository = GitBlitSuite.getTicgitRepository();
PlotWalk pw = new PlotWalk(repository);
PlotCommitList<PlotLane> commits = new PlotCommitList<PlotLane>();
commits.source(pw);
commits.fillTo(25);
for (PlotCommit<PlotLane> commit : commits) {
System.out.println(commit);
}
repository.close();
}
use of org.eclipse.jgit.revplot.PlotCommitList in project indy by Commonjava.
the class GitManager method getHeadCommit.
public ChangeSummary getHeadCommit(final File f) throws GitSubsystemException {
return lockAnd(me -> {
try {
final ObjectId oid = repo.resolve("HEAD");
final PlotWalk pw = new PlotWalk(repo);
final RevCommit rc = pw.parseCommit(oid);
pw.markStart(rc);
final String filepath = relativize(f);
pw.setTreeFilter(AndTreeFilter.create(PathFilter.create(filepath), TreeFilter.ANY_DIFF));
final PlotCommitList<PlotLane> cl = new PlotCommitList<>();
cl.source(pw);
cl.fillTo(1);
final PlotCommit<PlotLane> commit = cl.get(0);
return toChangeSummary(commit);
} catch (RevisionSyntaxException | IOException e) {
throw new GitSubsystemException("Failed to resolve HEAD commit for: %s. Reason: %s", e, f, e.getMessage());
}
});
}
Aggregations