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()); } } } }
final PlotCommit rObj = get(r); if (rObj == child) { childIndex = r; break; addBlockedPosition(blockedPositions, rObj); if (childOnLane != null) { for (int r = index - 1; r > childIndex; r--) { final PlotCommit rObj = get(r); if (rObj == childOnLane) { needDetour = true; laneToUse = nextFreeLane(blockedPositions); currCommit.addForkingOffLane(laneToUse); closeLane(laneToUse); } else { int newPos = getFreePosition(blockedPositions); freePositions.add(Integer.valueOf(laneToUse .getPosition())); drawLaneToChild(index, child, laneToUse); return laneToUse;
setupChildren(currCommit); currCommit.lane = nextFreeLane(); } else if (nChildren == 1 && currCommit.children[0].getParentCount() < 2) { laneLength.put(reservedLane, Integer.valueOf(lengthOfReservedLane + 1)); handleBlockedLanes(index, currCommit, childOnReservedLane); } else { currCommit.lane = nextFreeLane(); handleBlockedLanes(index, currCommit, null); PlotCommit firstParent = (PlotCommit) c.getParent(0); if (firstParent.lane != null && firstParent.lane != c.lane) closeLane(c.lane); continueActiveLanes(currCommit); if (currCommit.getParentCount() == 0) closeLane(currCommit.lane);
private PlotLane nextFreeLane(BitSet blockedPositions) { final PlotLane p = createLane(); p.position = getFreePosition(blockedPositions); activeLanes.add(p); laneLength.put(p, Integer.valueOf(1)); return p; }
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() ); } }); }
/** * Connects the commit at commitIndex to the child, using the given lane. * All blockades on the lane must be resolved before calling this method. * * @param commitIndex * @param child * @param laneToContinue */ private void drawLaneToChild(final int commitIndex, PlotCommit child, PlotLane laneToContinue) { for (int r = commitIndex - 1; r >= 0; r--) { final PlotCommit rObj = get(r); if (rObj == child) break; if (rObj != null) rObj.addPassingLane(laneToContinue); } }
private PlotLane nextFreeLane(BitSet blockedPositions) { final PlotLane p = createLane(); p.position = getFreePosition(blockedPositions); activeLanes.add(p); laneLength.put(p, Integer.valueOf(1)); return p; }
/** * Connects the commit at commitIndex to the child, using the given lane. * All blockades on the lane must be resolved before calling this method. * * @param commitIndex * @param child * @param laneToContinue */ private void drawLaneToChild(final int commitIndex, PlotCommit child, PlotLane laneToContinue) { for (int r = commitIndex - 1; r >= 0; r--) { final PlotCommit rObj = get(r); if (rObj == child) break; if (rObj != null) rObj.addPassingLane(laneToContinue); } }
final PlotCommit rObj = get(r); if (rObj == child) { childIndex = r; break; addBlockedPosition(blockedPositions, rObj); if (childOnLane != null) { for (int r = index - 1; r > childIndex; r--) { final PlotCommit rObj = get(r); if (rObj == childOnLane) { needDetour = true; laneToUse = nextFreeLane(blockedPositions); currCommit.addForkingOffLane(laneToUse); closeLane(laneToUse); } else { int newPos = getFreePosition(blockedPositions); freePositions.add(Integer.valueOf(laneToUse .getPosition())); drawLaneToChild(index, child, laneToUse); return laneToUse;
@Override protected void enter(final int index, final PlotCommit<L> currCommit) { setupChildren(currCommit); currCommit.lane = nextFreeLane(); } else if (nChildren == 1 && currCommit.children[0].getParentCount() < 2) { laneLength.put(reservedLane, Integer.valueOf(lengthOfReservedLane + 1)); handleBlockedLanes(index, currCommit, childOnReservedLane); } else { currCommit.lane = nextFreeLane(); handleBlockedLanes(index, currCommit, null); PlotCommit firstParent = (PlotCommit) c.getParent(0); if (firstParent.lane != null && firstParent.lane != c.lane) closeLane(c.lane); continueActiveLanes(currCommit); if (currCommit.getParentCount() == 0) closeLane(currCommit.lane);
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()); } } } }
private PlotLane nextFreeLane(BitSet blockedPositions) { final PlotLane p = createLane(); p.position = getFreePosition(blockedPositions); activeLanes.add(p); laneLength.put(p, Integer.valueOf(1)); return p; }
/** * Connects the commit at commitIndex to the child, using the given lane. * All blockades on the lane must be resolved before calling this method. * * @param commitIndex * @param child * @param laneToContinue */ private void drawLaneToChild(final int commitIndex, PlotCommit child, PlotLane laneToContinue) { for (int r = commitIndex - 1; r >= 0; r--) { final PlotCommit rObj = get(r); if (rObj == child) break; if (rObj != null) rObj.addPassingLane(laneToContinue); } }
final PlotCommit rObj = get(r); if (rObj == child) { childIndex = r; break; addBlockedPosition(blockedPositions, rObj); if (childOnLane != null) { for (int r = index - 1; r > childIndex; r--) { final PlotCommit rObj = get(r); if (rObj == childOnLane) { needDetour = true; laneToUse = nextFreeLane(blockedPositions); currCommit.addForkingOffLane(laneToUse); closeLane(laneToUse); } else { int newPos = getFreePosition(blockedPositions); freePositions.add(Integer.valueOf(laneToUse .getPosition())); drawLaneToChild(index, child, laneToUse); return laneToUse;
setupChildren(currCommit); currCommit.lane = nextFreeLane(); } else if (nChildren == 1 && currCommit.children[0].getParentCount() < 2) { laneLength.put(reservedLane, Integer.valueOf(lengthOfReservedLane + 1)); handleBlockedLanes(index, currCommit, childOnReservedLane); } else { currCommit.lane = nextFreeLane(); handleBlockedLanes(index, currCommit, null); PlotCommit firstParent = (PlotCommit) c.getParent(0); if (firstParent.lane != null && firstParent.lane != c.lane) closeLane(c.lane); continueActiveLanes(currCommit); if (currCommit.getParentCount() == 0) closeLane(currCommit.lane);