Attempt to fix graph layout when new heads are introduced
Sometime the new commit is no allocated onto a new lane leading to the commit being drawn on the wrong branch and something that looks like a merge. The drawback is that this also changes existing valid graphs. Bug: 368927 Change-Id: Ic8a8247c8a53be802c1be83850ed766b902ca646
This commit is contained in:
parent
b4f07df357
commit
a065a06c2a
|
@ -156,8 +156,8 @@ public void testSideBranch() throws Exception {
|
|||
|
||||
CommitListAssert test = new CommitListAssert(pcl);
|
||||
test.commit(c).lanePos(0).parents(a);
|
||||
test.commit(b).lanePos(1).parents(a);
|
||||
test.commit(a).lanePos(0).parents();
|
||||
test.commit(b).lanePos(0).parents(a);
|
||||
test.commit(a).lanePos(1).parents();
|
||||
test.noMoreCommits();
|
||||
}
|
||||
|
||||
|
@ -179,9 +179,9 @@ public void test2SideBranches() throws Exception {
|
|||
|
||||
CommitListAssert test = new CommitListAssert(pcl);
|
||||
test.commit(d).lanePos(0).parents(a);
|
||||
test.commit(c).lanePos(1).parents(a);
|
||||
test.commit(b).lanePos(1).parents(a);
|
||||
test.commit(a).lanePos(0).parents();
|
||||
test.commit(c).lanePos(0).parents(a);
|
||||
test.commit(b).lanePos(0).parents(a);
|
||||
test.commit(a).lanePos(1).parents();
|
||||
test.noMoreCommits();
|
||||
}
|
||||
|
||||
|
@ -214,14 +214,45 @@ public void testBug300282_1() throws Exception {
|
|||
CommitListAssert test = new CommitListAssert(pcl);
|
||||
test.commit(g).lanePos(0).parents(f);
|
||||
test.commit(f).lanePos(0).parents(a);
|
||||
test.commit(e).lanePos(1).parents(a);
|
||||
test.commit(d).lanePos(1).parents(a);
|
||||
test.commit(c).lanePos(1).parents(a);
|
||||
test.commit(b).lanePos(1).parents(a);
|
||||
test.commit(a).lanePos(0).parents();
|
||||
test.commit(e).lanePos(0).parents(a);
|
||||
test.commit(d).lanePos(0).parents(a);
|
||||
test.commit(c).lanePos(0).parents(a);
|
||||
test.commit(b).lanePos(0).parents(a);
|
||||
test.commit(a).lanePos(1).parents();
|
||||
test.noMoreCommits();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBug368927() throws Exception {
|
||||
final RevCommit a = commit();
|
||||
final RevCommit b = commit(a);
|
||||
final RevCommit c = commit(b);
|
||||
final RevCommit d = commit(b);
|
||||
final RevCommit e = commit(c);
|
||||
final RevCommit f = commit(e, d);
|
||||
final RevCommit g = commit(a);
|
||||
final RevCommit h = commit(f);
|
||||
final RevCommit i = commit(h);
|
||||
|
||||
PlotWalk pw = new PlotWalk(db);
|
||||
pw.markStart(pw.lookupCommit(i.getId()));
|
||||
pw.markStart(pw.lookupCommit(g.getId()));
|
||||
|
||||
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
|
||||
pcl.source(pw);
|
||||
pcl.fillTo(Integer.MAX_VALUE);
|
||||
CommitListAssert test = new CommitListAssert(pcl);
|
||||
test.commit(i).lanePos(1).parents(h);
|
||||
test.commit(h).lanePos(1).parents(f);
|
||||
test.commit(g).lanePos(0).parents(a);
|
||||
test.commit(f).lanePos(1).parents(e, d);
|
||||
test.commit(e).lanePos(0).parents(c);
|
||||
test.commit(d).lanePos(1).parents(b);
|
||||
test.commit(c).lanePos(0).parents(b);
|
||||
test.commit(b).lanePos(1).parents(a);
|
||||
test.commit(a).lanePos(2).parents();
|
||||
}
|
||||
|
||||
// test the history of the egit project between 9fdaf3c1 and e76ad9170f
|
||||
@Test
|
||||
public void testEgitHistory() throws Exception {
|
||||
|
|
|
@ -119,8 +119,12 @@ protected void enter(final int index, final PlotCommit<L> currCommit) {
|
|||
setupChildren(currCommit);
|
||||
|
||||
final int nChildren = currCommit.getChildCount();
|
||||
if (nChildren == 0)
|
||||
if (nChildren == 0) {
|
||||
currCommit.lane = nextFreeLane();
|
||||
activeLanes.add(currCommit.lane);
|
||||
closeLane(currCommit.lane);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nChildren == 1 && currCommit.children[0].getParentCount() < 2) {
|
||||
// Only one child, child has only us as their parent.
|
||||
|
|
Loading…
Reference in New Issue