use of org.eclipse.jgit.revplot.PlotLane 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.PlotLane 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());
}
});
}
use of org.eclipse.jgit.revplot.PlotLane in project ontrack by nemerosa.
the class GitRepositoryClientImpl method graph.
@Override
public GitLog graph(String from, String to) {
try {
GitRange range = range(from, to, false);
PlotWalk walk = new PlotWalk(git.getRepository());
// Log
walk.markStart(walk.lookupCommit(range.getFrom().getId()));
walk.markUninteresting(walk.lookupCommit(range.getTo().getId()));
PlotCommitList<PlotLane> commitList = new PlotCommitList<>();
commitList.source(walk);
commitList.fillTo(Integer.MAX_VALUE);
// Rendering
GitPlotRenderer renderer = new GitPlotRenderer(commitList);
GPlot plot = renderer.getPlot();
// Gets the commits
List<GitCommit> commits = Lists.transform(renderer.getCommits(), this::toCommit);
// OK
return new GitLog(plot, commits);
} catch (IOException e) {
throw new GitRepositoryIOException(repository.getRemote(), e);
}
}
Aggregations