import java.util.ArrayList;\r
import java.util.LinkedList;\r
import java.util.List;\r
+import java.util.Set;\r
+import java.util.TreeSet;\r
\r
import javax.imageio.ImageIO;\r
import javax.servlet.ServletException;\r
\r
// determine the appropriate width for the image\r
int numLanes = 0;\r
- int numCommits = Math.min(requestedCommits, commitList.size()); \r
- for (int i = 0; i < numCommits; i++) {\r
+ int numCommits = Math.min(requestedCommits, commitList.size());\r
+ Set<String> parents = new TreeSet<String>();\r
+ for (int i = 0; i < commitList.size(); i++) {\r
PlotCommit<Lane> commit = commitList.get(i);\r
- int pos = commit.getLane().getPosition();\r
- numLanes = Math.max(numLanes, pos + 1);\r
+ boolean checkLane = false;\r
+ \r
+ if (i < numCommits) {\r
+ // commit in visible list\r
+ checkLane = true;\r
+ \r
+ // remember parents\r
+ for (RevCommit p : commit.getParents()) {\r
+ parents.add(p.getName());\r
+ }\r
+ } else if (parents.contains(commit.getName())) {\r
+ // commit outside visible list, but it is a parent of a\r
+ // commit in the visible list so we need to know it's lane\r
+ // assignment\r
+ checkLane = true;\r
+ }\r
+ \r
+ if (checkLane) {\r
+ int pos = commit.getLane().getPosition();\r
+ numLanes = Math.max(numLanes, pos + 1);\r
+ }\r
}\r
\r
int graphWidth = numLanes * LANE_WIDTH + RIGHT_PAD;\r
g = image.createGraphics();\r
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);\r
LanesRenderer renderer = new LanesRenderer();\r
- for (int i = 0; i < numCommits; i++) {\r
+ for (int i = 0; i < commitList.size(); i++) {\r
PlotCommit<Lane> commit = commitList.get(i);\r
Graphics row = g.create(0, i*rowHeight, graphWidth, rowHeight);\r
try {\r