Search in sources :

Example 1 with GitPlotRenderer

use of net.nemerosa.ontrack.git.model.plot.GitPlotRenderer 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);
    }
}
Also used : GitPlotRenderer(net.nemerosa.ontrack.git.model.plot.GitPlotRenderer) PlotLane(org.eclipse.jgit.revplot.PlotLane) GPlot(net.nemerosa.ontrack.git.model.plot.GPlot) PlotCommitList(org.eclipse.jgit.revplot.PlotCommitList) IOException(java.io.IOException) PlotWalk(org.eclipse.jgit.revplot.PlotWalk)

Aggregations

IOException (java.io.IOException)1 GPlot (net.nemerosa.ontrack.git.model.plot.GPlot)1 GitPlotRenderer (net.nemerosa.ontrack.git.model.plot.GitPlotRenderer)1 PlotCommitList (org.eclipse.jgit.revplot.PlotCommitList)1 PlotLane (org.eclipse.jgit.revplot.PlotLane)1 PlotWalk (org.eclipse.jgit.revplot.PlotWalk)1