소스 검색

PlotCommitList: Close plot lanes at root commits

Bug: 443006
Change-Id: I40b1eb044fa2d9e6c5d4b956c17e32ca6c1bd39f
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
tags/v3.5.0.201409071800-rc1
Konrad Kügler 9 년 전
부모
커밋
9ac59efbbd

+ 38
- 0
org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java 파일 보기

new PlotLane[] { laneB }, test.current.passingLanes); new PlotLane[] { laneB }, test.current.passingLanes);
test.noMoreCommits(); test.noMoreCommits();
} }

@Test
public void testTwoRoots1() throws Exception {
final RevCommit a = commit();
final RevCommit b = commit();

PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(a));
pw.markStart(pw.lookupCommit(b));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);

CommitListAssert test = new CommitListAssert(pcl);
test.commit(b).lanePos(0);
test.commit(a).lanePos(0);
test.noMoreCommits();
}

@Test
public void testTwoRoots2() throws Exception {
final RevCommit a = commit();
final RevCommit b1 = commit();
final RevCommit b2 = commit(b1);

PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(a));
pw.markStart(pw.lookupCommit(b2));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);

CommitListAssert test = new CommitListAssert(pcl);
test.commit(b2).lanePos(0);
test.commit(b1).lanePos(0);
test.commit(a).lanePos(0);
test.noMoreCommits();
}
} }

+ 5
- 5
org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java 파일 보기

final int nChildren = currCommit.getChildCount(); final int nChildren = currCommit.getChildCount();
if (nChildren == 0) { if (nChildren == 0) {
currCommit.lane = nextFreeLane(); currCommit.lane = nextFreeLane();
continueActiveLanes(currCommit);
return;
}

if (nChildren == 1 && currCommit.children[0].getParentCount() < 2) {
} else if (nChildren == 1
&& currCommit.children[0].getParentCount() < 2) {
// Only one child, child has only us as their parent. // Only one child, child has only us as their parent.
// Stay in the same lane as the child. // Stay in the same lane as the child.


closeLane(c.lane); closeLane(c.lane);
} }
} }

continueActiveLanes(currCommit); continueActiveLanes(currCommit);
if (currCommit.getParentCount() == 0)
closeLane(currCommit.lane);
} }


private void continueActiveLanes(final PlotCommit currCommit) { private void continueActiveLanes(final PlotCommit currCommit) {

Loading…
취소
저장