summaryrefslogtreecommitdiffstats
path: root/src/main/java/com
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-09-18 13:00:39 -0400
committerJames Moger <james.moger@gitblit.com>2013-09-18 13:00:39 -0400
commit6de953137ce26e380f88b77876394d3c6fbdd766 (patch)
tree883a1f2267b185ba4a15ad02f747bed25f56bc69 /src/main/java/com
parent91d3b05687f04c0f6c91718d8760f5de59fb3404 (diff)
downloadgitblit-6de953137ce26e380f88b77876394d3c6fbdd766.tar.gz
gitblit-6de953137ce26e380f88b77876394d3c6fbdd766.zip
Improve non-visible parent lane rendering for BranchGraphServlet
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/gitblit/BranchGraphServlet.java32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/main/java/com/gitblit/BranchGraphServlet.java b/src/main/java/com/gitblit/BranchGraphServlet.java
index 95be6132..f46b8e6f 100644
--- a/src/main/java/com/gitblit/BranchGraphServlet.java
+++ b/src/main/java/com/gitblit/BranchGraphServlet.java
@@ -32,6 +32,8 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
@@ -153,11 +155,31 @@ public class BranchGraphServlet extends HttpServlet {
// determine the appropriate width for the image
int numLanes = 0;
- int numCommits = Math.min(requestedCommits, commitList.size());
- for (int i = 0; i < numCommits; i++) {
+ int numCommits = Math.min(requestedCommits, commitList.size());
+ Set<String> parents = new TreeSet<String>();
+ for (int i = 0; i < commitList.size(); i++) {
PlotCommit<Lane> commit = commitList.get(i);
- int pos = commit.getLane().getPosition();
- numLanes = Math.max(numLanes, pos + 1);
+ boolean checkLane = false;
+
+ if (i < numCommits) {
+ // commit in visible list
+ checkLane = true;
+
+ // remember parents
+ for (RevCommit p : commit.getParents()) {
+ parents.add(p.getName());
+ }
+ } else if (parents.contains(commit.getName())) {
+ // commit outside visible list, but it is a parent of a
+ // commit in the visible list so we need to know it's lane
+ // assignment
+ checkLane = true;
+ }
+
+ if (checkLane) {
+ int pos = commit.getLane().getPosition();
+ numLanes = Math.max(numLanes, pos + 1);
+ }
}
int graphWidth = numLanes * LANE_WIDTH + RIGHT_PAD;
@@ -170,7 +192,7 @@ public class BranchGraphServlet extends HttpServlet {
g = image.createGraphics();
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
LanesRenderer renderer = new LanesRenderer();
- for (int i = 0; i < numCommits; i++) {
+ for (int i = 0; i < commitList.size(); i++) {
PlotCommit<Lane> commit = commitList.get(i);
Graphics row = g.create(0, i*rowHeight, graphWidth, rowHeight);
try {