public static void main(String[] args) throws IOException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { try (PlotWalk revWalk = new PlotWalk(repository)) { ObjectId rootId = repository.resolve("refs/heads/master"); RevCommit root = revWalk.parseCommit(rootId); revWalk.markStart(root); PlotCommitList<PlotLane> plotCommitList = new PlotCommitList<>(); plotCommitList.source(revWalk); plotCommitList.fillTo(Integer.MAX_VALUE); System.out.println("Printing children of commit " + root); for (RevCommit com : revWalk) { System.out.println("Child: " + com); } System.out.println("Printing with next()"); System.out.println("next: " + revWalk.next()); } } } }
public static void main(String[] args) throws IOException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { try (PlotWalk revWalk = new PlotWalk(repository)) { ObjectId rootId = repository.resolve("refs/heads/master"); RevCommit root = revWalk.parseCommit(rootId); revWalk.markStart(root); PlotCommitList<PlotLane> plotCommitList = new PlotCommitList<>(); plotCommitList.source(revWalk); plotCommitList.fillTo(Integer.MAX_VALUE); System.out.println("Printing children of commit " + root); for (RevCommit com : revWalk) { System.out.println("Child: " + com); } System.out.println("Printing with next()"); System.out.println("next: " + revWalk.next()); } } } }
@Override protected int walkLoop() throws Exception { graphPane.getCommitList().source(walk); graphPane.getCommitList().fillTo(Integer.MAX_VALUE); frame.setTitle("[" + repoName() + "]"); //$NON-NLS-1$ //$NON-NLS-2$ frame.pack(); frame.setVisible(true); return graphPane.getCommitList().size(); }
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() ); } }); }