The Unified and Autonomous Development Platform
midwork
robin shinec8dee9cd02af
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/commitgraph/CommitGraphResourceReference.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/commitgraph/CommitGraphResourceReference.javanew file mode 100644index 0000000000..1be91ea52d--- /dev/null+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/commitgraph/CommitGraphResourceReference.java@@ -0,0 +1,33 @@+package com.pmease.gitplex.web.assets.commitgraph;++import java.util.ArrayList;+import java.util.List;++import org.apache.wicket.markup.head.CssHeaderItem;+import org.apache.wicket.markup.head.HeaderItem;+import org.apache.wicket.markup.head.JavaScriptHeaderItem;+import org.apache.wicket.request.resource.CssResourceReference;+import org.apache.wicket.request.resource.JavaScriptResourceReference;++import com.pmease.commons.wicket.assets.snapsvg.SnapSvgResourceReference;++public class CommitGraphResourceReference extends JavaScriptResourceReference {++ private static final long serialVersionUID = 1L;++ public static final CommitGraphResourceReference INSTANCE = new CommitGraphResourceReference();++ private CommitGraphResourceReference() {+ super(CommitGraphResourceReference.class, "commit-graph.js");+ }++ @Override+ public Iterable<? extends HeaderItem> getDependencies() {+ List<HeaderItem> dependencies = new ArrayList<>();+ dependencies.add(JavaScriptHeaderItem.forReference(SnapSvgResourceReference.INSTANCE));+ dependencies.add(CssHeaderItem.forReference(+ new CssResourceReference(CommitGraphResourceReference.class, "commit-graph.css")));+ return dependencies;+ }++}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/commitgraph/CommitGraphUtils.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/commitgraph/CommitGraphUtils.javanew file mode 100644index 0000000000..dd8f26882f--- /dev/null+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/commitgraph/CommitGraphUtils.java@@ -0,0 +1,89 @@+package com.pmease.gitplex.web.assets.commitgraph;++import java.util.ArrayList;+import java.util.Collections;+import java.util.Comparator;+import java.util.HashMap;+import java.util.List;+import java.util.Map;+import java.util.Stack;++import com.fasterxml.jackson.core.JsonProcessingException;+import com.fasterxml.jackson.databind.ObjectMapper;+import com.pmease.commons.git.Commit;+import com.pmease.gitplex.core.GitPlex;++public class CommitGraphUtils {++ public static void sort(List<Commit> commits, int from) {+ final Map<String, Long> hash2index = new HashMap<>();+ Map<String, Commit> hash2commit = new HashMap<>();+ for (int i=0; i<commits.size(); i++) {+ Commit commit = commits.get(i);+ hash2index.put(commit.getHash(), 1L*i*commits.size());+ hash2commit.put(commit.getHash(), commit);+ }++ Stack<Commit> stack = new Stack<>();++ for (int i=commits.size()-1; i>=from; i--)+ stack.push(commits.get(i));++ // commits are nearly ordered, so this should be fast+ while (!stack.isEmpty()) {+ Commit commit = stack.pop();+ long commitIndex = hash2index.get(commit.getHash());+ int count = 1;+ for (String parentHash: commit.getParentHashes()) {+ Long parentIndex = hash2index.get(parentHash);+ if (parentIndex != null && parentIndex.longValue()<commitIndex) {+ stack.push(hash2commit.get(parentHash));+ hash2index.put(parentHash, commitIndex+(count++));+ }+ }+ }++ Collections.sort(commits, new Comparator<Commit>() {++ @Override+ public int compare(Commit o1, Commit o2) {+ long value = hash2index.get(o1.getHash()) - hash2index.get(o2.getHash());+ if (value < 0)+ return -1;+ else if (value > 0)+ return 1;+ else+ return 0;+ }++ });+ }++ public static String asJSON(List<Commit> commits) {+ Map<String, Integer> hash2index = new HashMap<>();+ int commitIndex = 0;+ for (int i=0; i<commits.size(); i++) {+ Commit commit = commits.get(i);+ if (commit != null)+ hash2index.put(commit.getHash(), commitIndex++);+ }+ List<List<Integer>> commitIndexes = new ArrayList<>();+ for (Commit commit: commits) {+ if (commit != null) {+ List<Integer> parentIndexes = new ArrayList<>();+ for (String parentHash: commit.getParentHashes()) {+ Integer parentIndex = hash2index.get(parentHash);+ if (parentIndex != null)+ parentIndexes.add(parentIndex);+ }+ commitIndexes.add(parentIndexes);+ }+ }+ try {+ return GitPlex.getInstance(ObjectMapper.class).writeValueAsString(commitIndexes);+ } catch (JsonProcessingException e) {+ throw new RuntimeException(e);+ }+ }++}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/commitgraph/commit-graph.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/commitgraph/commit-graph.cssnew file mode 100644index 0000000000..388e102817--- /dev/null+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/commitgraph/commit-graph.css@@ -0,0 +1,108 @@+.commit-graph {+ position: absolute;+}+.commit-dot {+ fill: #53a8fd;+ stroke: #53a8fd;+}+.commit-line {+ stroke-width: 1px;+ stroke: #53a8fd;+ fill: none;+}++.commit-dot-color1 {+ fill: #53a8fd;+ stroke: #53a8fd;+}+.commit-line-color1 {+ stroke: #53a8fd;+}++.commit-dot-color2 {+ fill: #09c112;+ stroke: #09c112;+}+.commit-line-color2 {+ stroke: #09c112;+}++.commit-dot-color3 {+ fill: #ff4242;+ stroke: #ff4242;+}+.commit-line-color3 {+ stroke: #ff4242;+}++.commit-dot-color4 {+ fill: #0252a2;+ stroke: #0252a2;+}+.commit-line-color4 {+ stroke: #0252a2;+}++.commit-dot-color5 {+ fill: #056d0b;+ stroke: #056d0b;+}+.commit-line-color5 {+ stroke: #056d0b;+}++.commit-dot-color6 {+ fill: #b00000;+ stroke: #b00000;+}+.commit-line-color6 {+ stroke: #b00000;+}++.commit-dot-color7 {+ fill: #af29f8;+ stroke: #af29f8;+}+.commit-line-color7 {+ stroke: #af29f8;+}++.commit-dot-color8 {+ fill: #ee6c1e;+ stroke: #ee6c1e;+}+.commit-line-color8 {+ stroke: #ee6c1e;+}++.commit-dot-color9 {+ fill: #ef56cd;+ stroke: #ef56cd;+}+.commit-line-color9 {+ stroke: #ef56cd;+}++.commit-dot-color10 {+ fill: #630596;+ stroke: #630596;+}+.commit-line-color10 {+ stroke: #630596;+}++.commit-dot-color11 {+ fill: #8e4509;+ stroke: #8e4509;+}+.commit-line-color11 {+ stroke: #8e4509;+}++.commit-dot-color12 {+ fill: #9b0f7b;+ stroke: #9b0f7b;+}+.commit-line-color12 {+ stroke: #9b0f7b;+}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/commitgraph/commit-graph.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/commitgraph/commit-graph.jsnew file mode 100644index 0000000000..b18de761a7--- /dev/null+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/commitgraph/commit-graph.js@@ -0,0 +1,431 @@+gitplex.commitgraph = {+ render: function(containerId, commits) {+ var $container = $("#" + containerId);+ $container.prepend("<svg class='commit-graph'></svg>");+ var $graph = $container.children("svg");+ gitplex.commitgraph.populateData($graph, commits);+ gitplex.commitgraph.drawGraph($graph);++ var paper = Snap($graph[0]);+ function getCommitDot(e) {+ var $target = $(e.target);+ if (!$target.hasClass("commit") || !$target.is("li"))+ $target = $target.closest("li.commit");+ var index = $target.attr("class").split(" ").pop().split("-").pop();+ return paper.select("#" + containerId + "-commit-dot-" + index);+ }+ var $commits = $graph.next("ul").find("li.commit");+ $commits.off("mouseenter");+ $commits.off("mouseleave");+ $commits.mouseenter(function(e) {+ getCommitDot(e).attr("strokeWidth", 3);+ });+ $commits.mouseleave(function(e) {+ getCommitDot(e).attr("strokeWidth", 0);+ });+ },++ /*+ * commits is an array of ordered commit object, and the commit object is itself a+ * list of parent indexes+ */+ populateData: function($graph, commits) {+ var columnsLimit = 12;++ var colorsLimit = 12;++ /*+ * rows store the map of line to row. A line represents a child->parent relationship.+ * For instance line(1,5) represents the line from commit at row 1 (the child ) to+ * commit at row 5 (the parent). In case child row index equals parent row index,+ * the line represents a commit.+ *+ */+ var rows = [];+ var parent2children = {};+ var colors = {};++ var colorStack = [];+ function getSortedLines(row, reverse) {+ var lines = [];+ var keys = Object.keys(row);+ for (var i in keys)+ lines.push(keys[i]);++ lines.sort(function(x, y) {+ if (reverse)+ return row[y] - row[x];+ else+ return row[x] - row[y];+ });+ return lines;+ }++ function fromKey(lineKey) {+ return lineKey.split(',').map(function(item) {+ return parseInt(item, 10);+ });+ }++ function toKey(line) {+ return line[0] + "," + line[1];+ }++ function assignColor(lineKey) {+ var color = colors[lineKey];+ if (color == undefined) {+ if (colorStack.length == 0) {+ for (var i=colorsLimit; i>=1; i--)+ colorStack.push(i);+ }+ color = colorStack.pop();+ colors[lineKey] = color;+ }+ return color;+ }++ for (var i in commits) {+ commits[i] = commits[i][1];+ var parents = commits[i];+ for (var j in parents) {+ var parent = parents[j];+ var children = parent2children[parent];+ if (children == undefined) {+ children = [];+ parent2children[parent] = children;+ }+ children.push(i);+ }+ }++ for (var rowIndex in commits) {+ var row = {};+ if (rowIndex == 0) {+ row["0,0"] = 0;+ } else {+ var parents = commits[rowIndex-1];+ // special line represents the commit at rowIndex itself+ var commitLineKey = toKey([rowIndex, rowIndex]);+ var lastRow = rows[rowIndex-1];+ var column = 0;+ var linesOfLastRow = getSortedLines(lastRow, false);+ for (var i in linesOfLastRow) {+ var lineOfLastRow = fromKey(linesOfLastRow[i]);+ if (lineOfLastRow[1] < 0) // line is cutted due to max columns limitation+ continue;+ if (lineOfLastRow[1] != lineOfLastRow[0]) { // not a commit point+ // line not started from last row, in this case, the line+ // only occupies a column when it goes through current row+ if (lineOfLastRow[1] == rowIndex) {+ if (row[commitLineKey] == undefined)+ row[commitLineKey] = column++;+ } else {+ row[toKey(lineOfLastRow)] = column++;+ }+ } else {+ for (var j in parents) {+ var parent = parents[j];+ if (parent == rowIndex) {+ if (row[commitLineKey] == undefined)+ row[commitLineKey] = column++;+ } else {+ row[toKey([rowIndex-1, parent])] = column++;+ }+ }+ }+ }++ if (row[commitLineKey] == undefined)+ row[commitLineKey] = column++;+ if (column > columnsLimit) {+ var reversedLines = getSortedLines(row, true);+ for (var i in reversedLines) {+ var line = fromKey(reversedLines[i]);+ if (line[0] == rowIndex-1) {+ var cuttedLine = [line[0], line[1]*-1];+ var lineKey = toKey(line);+ var lineColumn = row[lineKey];+ delete row[lineKey];+ row[toKey(cuttedLine)] = lineColumn;+ column--;+ if (column == columnsLimit)+ break;+ }+ }+ if (column != columnsLimit)+ throw "Error calculating commit graph at row " + rowIndex;+ }++ var cuttedLines = [];+ var children = parent2children[rowIndex];+ if (children) {+ for (var i in children) {+ var child = children[i];+ if (child != rowIndex-1) {+ var line = [child, rowIndex];+ var cuttedLine = [child, rowIndex*-1];+ var lineKey = toKey(line);+ var cuttedLineKey = toKey(cuttedLine);+ if (lastRow[lineKey] == undefined) {+ if (lastRow[cuttedLineKey] != undefined) {+ var cuttedLineColumn = lastRow[cuttedLineKey];+ delete lastRow[cuttedLineKey];+ lastRow[lineKey] = cuttedLineColumn;+ } else {+ cuttedLines.push(cuttedLine);+ }+ }+ }+ }+ }+ if (cuttedLines.length != 0) {+ // for every disappeared line, we need to make them appear again in last row+ // so that end part of the line can be drawn from last row to this row.+ // Below code find column in last row to insert these appeared lines, and+ // we want to make sure that this column can result in minimum line crossovers.+ var commitColumn = row[commitLineKey];+ var insertColumn = 0;+ for (var i=linesOfLastRow.length-1; i>=0; i--) {+ var lineOfLastRowKey = linesOfLastRow[i];+ var lineOfLastRow = fromKey(lineOfLastRowKey);+ if (lineOfLastRow[0] == lineOfLastRow[1]) {+ var found = false;+ for (var j in parents) {+ var parent = parents[j];+ var lineKey = toKey([rowIndex-1, parent]);+ var lineColumn = row[lineKey];+ if (lineColumn != undefined) {+ if (lineColumn<commitColumn) {+ found = true;+ break;+ }+ } else {+ lineKey = toKey([rowIndex-1, parent*-1]);+ lineColumn = row[lineKey];+ if (lineColumn != undefined && lineColumn<commitColumn) {+ found = true;+ break;+ }+ }+ }+ if (found) {+ insertColumn = i;+ break;+ }+ } else {+ var lineColumn = row[lineOfLastRowKey];+ if (lineColumn!=undefined && lineColumn<commitColumn) {+ insertColumn = i;+ break;+ }+ }+ }+ column = insertColumn+1;+ for (var i in cuttedLines)+ lastRow[toKey(cuttedLines[i])] = column++;+ for (var i=insertColumn+1; i<linesOfLastRow.length; i++)+ lastRow[linesOfLastRow[i]] = column++;+ }+ }+ rows.push(row);+ }+ for (var i=1; i<rows.length; i++) {+ var row = rows[i];+ var lastRow = rows[i-1];+ var lines = getSortedLines(row, false);+ var lastLines = getSortedLines(lastRow, true);++ var recycledColors = [];++ for (var j in lines) {+ var line = fromKey(lines[j]);+ if (line[0] == line[1]) {+ for (var k in lastLines) {+ var lastLine = fromKey(lastLines[k]);+ if (lastLine[0] == lastLine[1]) {+ if (commits[i-1].indexOf(i) != -1)+ recycledColors.push(assignColor(toKey([i-1, i])));+ } else if (lastLine[1] == i) {+ recycledColors.push(assignColor(toKey(lastLine)));+ } else if (lastLine[1]*-1 == i) {+ recycledColors.push(assignColor(toKey([lastLine[0], i])));+ }+ }+ } else {+ if (line[1] < 0)+ assignColor(toKey([line[0], line[1]*-1]));+ else+ assignColor(toKey(line));+ }+ }+ for (var j in recycledColors)+ colorStack.push(recycledColors[j]);+ }++ $graph.data("rows", rows);+ $graph.data("commits", commits);+ $graph.data("parent2children", parent2children);+ $graph.data("colors", colors);+ },+ drawGraph: function($graph) {+ var columnWidth = 12;+ var topOffset = 22;+ var rightOffset = 12;+ var dotSize = 3;++ var dotColorClass = "commit-dot-color";+ var lineColorClass = "commit-line-color";++ var rows = $graph.data("rows");+ var commits = $graph.data("commits");+ var parent2children = $graph.data("parent2children");+ var colors = $graph.data("colors");;++ var maxColumns = 0;+ for (var i in rows) {+ var columns = Object.keys(rows[i]).length;+ if (columns > maxColumns)+ maxColumns = columns;+ }++ function fromKey(lineKey) {+ return lineKey.split(',').map(function(item) {+ return parseInt(item, 10);+ });+ }++ function toKey(line) {+ return line[0] + "," + line[1];+ }++ var $container = $graph.parent();+ var $list = $container.children("ul");+ var containerTop = $container.offset().top - topOffset;++ function getTop(row) {+ return $list.find(".commit-item-"+row).offset().top - containerTop;+ }++ function getLeft(column) {+ return column*columnWidth + columnWidth/2;+ }++ $list.css("margin-left", maxColumns*columnWidth+rightOffset);++ $graph.empty();+ $graph.height($list.outerHeight());+ $graph.width(maxColumns*columnWidth);+ var paper = Snap($graph[0]);++ for (var i=0; i<commits.length; i++) {+ var parents = commits[i];+ var row = rows[i];++ var column = row[toKey([i, i])];+ var left = getLeft(column);+ var top = getTop(i);++ if (i != commits.length-1) {+ var nextRow = rows[i+1];+ var nextTop = getTop(i+1);+ for (var lineKey in row) {+ var line = fromKey(lineKey);+ column = row[lineKey];++ function drawLine(nextColumn, color, upArrow, downArrow) {+ if (nextColumn != undefined) {+ var arrowOffset = 10;+ var arrowWidth = 4;+ var arrowHeight = 8;+ var left = getLeft(column);+ var nextLeft = getLeft(nextColumn);+ var line = paper.line(left, top, nextLeft, nextTop);+ line.addClass("commit-line");+ line.addClass(lineColorClass + color);+ var arrow;+ if (upArrow) {+ arrow = paper.path("M" + left + " " + top + "l0 -" + arrowOffset+ + "l-" + arrowWidth + " " + arrowHeight + "m" + arrowWidth*2+ + " 0l-" + arrowWidth + " -" + arrowHeight);+ } else if (downArrow) {+ arrow = paper.path("M" + nextLeft + " " + nextTop + "l0 " + arrowOffset+ + "l-" + arrowWidth + " -" + arrowHeight + "m" + arrowWidth*2+ + " 0l-" + arrowWidth + " " + arrowHeight);+ }+ if (arrow) {+ arrow.addClass("commit-line");+ arrow.addClass(lineColorClass + color);+ }+ }+ }++ if (line[0] == line[1]) {+ for (var j in parents) {+ var parent = parents[j];+ if (parent == i+1) {+ drawLine(nextRow[toKey([i+1, i+1])], colors[toKey([i, i+1])]);+ } else {+ var nextLineKey = toKey([i, parent]);+ var nextColumn = nextRow[nextLineKey];+ if (nextColumn != undefined) {+ drawLine(nextColumn, colors[nextLineKey], false, false);+ } else {+ var nextCuttedLineKey = toKey([i, -1*parent]);+ drawLine(nextRow[nextCuttedLineKey], colors[nextLineKey], false, true);+ }+ }+ }+ } else {+ if (line[1] < 0) {+ if (line[1]*-1 == i+1) {+ var nextColumn = nextRow[toKey([i+1, i+1])];+ drawLine(nextColumn, colors[toKey([line[0], i+1])], true, false);+ }+ } else if (line[1] == i+1){+ var nextColumn = nextRow[toKey([i+1, i+1])];+ drawLine(nextColumn, colors[lineKey], false, false);+ } else {+ drawLine(nextRow[lineKey], colors[lineKey], false, false);+ }+ }+ }+ }+ }++ for (var i in commits) {+ var parents = commits[i];+ var row = rows[i];++ var column = row[toKey([i, i])];+ var left = getLeft(column);+ var top = getTop(i);+ var circle = paper.circle(left, top, dotSize);+ circle.addClass("commit-dot");+ if (parents.length != 0) {+ circle.addClass(dotColorClass + colors[toKey([i, parents[0]])]);+ } else {+ var children = parent2children[i];+ if (children && children.length != 0)+ circle.addClass(dotColorClass + colors[toKey([children[0], i])]);+ }+ circle.attr("id", $graph.parent().attr("id") + "-commit-dot-" + i);+ circle.mouseover(function() {+ this.attr("strokeWidth", 4);+ var index = this.attr("id").split("-").pop();+ $list.find(".commit-item-" + index).addClass("hover");+ });+ circle.mouseout(function() {+ this.attr("strokeWidth", 0);+ var index = this.attr("id").split("-").pop();+ $list.find(".commit-item-" + index).removeClass("hover");+ });+ }++ }+};+$(window).resize(function(e) {+ e.stopPropagation();+ $(".commit-graph").each(function() {+ gitplex.commitgraph.drawGraph($(this));+ });+});diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/CommitListPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/CommitListPanel.htmlindex af9835b1c4..b864079baa 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/CommitListPanel.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/CommitListPanel.html@@ -1,16 +1,21 @@<wicket:panel><div class="commit-list"><div wicket:id="tooManyCommits" class="alert alert-warning"></div>- <ul class="list-unstyled">- <li wicket:id="commits"><div wicket:id="commit"></div></li>- </ul>+ <div wicket:id="container">+ <ul class="list-unstyled">+ <li wicket:id="commits"><wicket:container wicket:id="commit"></wicket:container></li>+ </ul>+ </div></div><wicket:fragment wicket:id="commitFrag"><div class="avatar pull-left"><span wicket:id="avatar"></span></div><div class="detail pull-left">- <div wicket:id="message" class="message"></div>+ <div class="message-and-labels clearfix">+ <div wicket:id="message" class="message pull-left"></div>+ <span wicket:id="labels" class="label label-default pull-left"></span>+ </div><div wicket:id="contribution"></div></div><div wicket:id="hashAndCode" class="pull-right"></div>diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/CommitListPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/CommitListPanel.javaindex 9f3dbcea35..eaa545353a 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/CommitListPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/CommitListPanel.java@@ -2,15 +2,21 @@ package com.pmease.gitplex.web.component.commitlist;import java.util.ArrayList;import java.util.List;+import java.util.Map;import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.markup.head.CssHeaderItem;import org.apache.wicket.markup.head.IHeaderResponse;+import org.apache.wicket.markup.head.JavaScriptHeaderItem;+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;+import org.apache.wicket.markup.html.WebMarkupContainer;import org.apache.wicket.markup.html.basic.Label;import org.apache.wicket.markup.html.list.ListItem;import org.apache.wicket.markup.html.list.ListView;import org.apache.wicket.markup.html.panel.Fragment;import org.apache.wicket.markup.html.panel.Panel;+import org.apache.wicket.markup.repeater.RepeatingView;+import org.apache.wicket.model.AbstractReadOnlyModel;import org.apache.wicket.model.IModel;import org.apache.wicket.model.LoadableDetachableModel;import org.apache.wicket.request.resource.CssResourceReference;@@ -19,10 +25,13 @@ import org.joda.time.DateTime;import com.pmease.commons.git.Commit;import com.pmease.gitplex.core.entity.Depot;import com.pmease.gitplex.web.Constants;+import com.pmease.gitplex.web.assets.commitgraph.CommitGraphResourceReference;+import com.pmease.gitplex.web.assets.commitgraph.CommitGraphUtils;import com.pmease.gitplex.web.component.avatar.ContributorAvatars;import com.pmease.gitplex.web.component.commitmessage.CommitMessagePanel;import com.pmease.gitplex.web.component.contributionpanel.ContributionPanel;import com.pmease.gitplex.web.component.hashandcode.HashAndCodePanel;+import com.pmease.gitplex.web.model.CommitRefsModel;@SuppressWarnings("serial")public class CommitListPanel extends Panel {@@ -31,10 +40,38 @@ public class CommitListPanel extends Panel {private final IModel<List<Commit>> commitsModel;+ private final IModel<Map<String, List<String>>> labelsModel = new CommitRefsModel(new AbstractReadOnlyModel<Depot>() {++ @Override+ public Depot getObject() {+ return depotModel.getObject();+ }++ });++ private WebMarkupContainer container;+public CommitListPanel(String id, IModel<Depot> depotModel, IModel<List<Commit>> commitsModel) {super(id);this.depotModel = depotModel;- this.commitsModel = commitsModel;+ this.commitsModel = new LoadableDetachableModel<List<Commit>>() {++ @Override+ protected List<Commit> load() {+ List<Commit> commits = commitsModel.getObject();+ if (commits.size() > Constants.MAX_DISPLAY_COMMITS)+ commits = commits.subList(commits.size()-Constants.MAX_DISPLAY_COMMITS, commits.size());+ CommitGraphUtils.sort(commits, 0);+ return separateByDate(commits);+ }++ @Override+ protected void onDetach() {+ commitsModel.detach();+ super.onDetach();+ }++ };}@Override@@ -52,41 +89,52 @@ public class CommitListPanel extends Panel {}});- add(new ListView<Commit>("commits", new LoadableDetachableModel<List<Commit>>() {+ container = new WebMarkupContainer("container");+ container.setOutputMarkupId(true);+ add(container);+ container.add(new ListView<Commit>("commits", commitsModel) {+ private int itemIndex;+@Override- protected List<Commit> load() {- List<Commit> commits = commitsModel.getObject();- if (commits.size() > Constants.MAX_DISPLAY_COMMITS)- commits = commits.subList(commits.size()-Constants.MAX_DISPLAY_COMMITS, commits.size());- return separateByDate(commits);+ protected void onBeforeRender() {+ itemIndex = 0;+ super.onBeforeRender();}-- }) {@Overrideprotected void populateItem(ListItem<Commit> item) {Commit commit = item.getModelObject();+ Fragment fragment;if (commit != null) {- Fragment fragment = new Fragment("commit", "commitFrag", CommitListPanel.this);+ fragment = new Fragment("commit", "commitFrag", CommitListPanel.this);fragment.add(new ContributorAvatars("avatar", commit.getAuthor(), commit.getCommitter()));+fragment.add(new CommitMessagePanel("message", depotModel, item.getModel()));++ RepeatingView labelsView = new RepeatingView("labels");++ List<String> commitLabels = labelsModel.getObject().get(commit.getHash());+ if (commitLabels == null)+ commitLabels = new ArrayList<>();+ for (String label: commitLabels)+ labelsView.add(new Label(labelsView.newChildId(), label));+ fragment.add(labelsView);+fragment.add(new ContributionPanel("contribution", commit.getAuthor(), commit.getCommitter()));fragment.add(new HashAndCodePanel("hashAndCode", depotModel, commit.getHash()));- fragment.add(AttributeAppender.append("class", "commit clearfix"));-- item.add(fragment);+ item.add(AttributeAppender.append("class", "commit clearfix commit-item-" + itemIndex++));} else {- Fragment fragment = new Fragment("commit", "dateFrag", CommitListPanel.this);+ fragment = new Fragment("commit", "dateFrag", CommitListPanel.this);DateTime dateTime = new DateTime(getModelObject().get(item.getIndex()+1).getCommitter().getWhen());fragment.add(new Label("date", Constants.DATE_FORMATTER.print(dateTime)));if (item.getIndex() == 0)- fragment.add(AttributeAppender.append("class", "date first"));+ item.add(AttributeAppender.append("class", "date first"));else- fragment.add(AttributeAppender.append("class", "date"));- item.add(fragment);+ item.add(AttributeAppender.append("class", "date"));}+ item.add(fragment);}});@@ -112,8 +160,13 @@ public class CommitListPanel extends Panel {public void renderHead(IHeaderResponse response) {super.renderHead(response);+ response.render(JavaScriptHeaderItem.forReference(CommitGraphResourceReference.INSTANCE));response.render(CssHeaderItem.forReference(new CssResourceReference(CommitListPanel.class, "commit-list.css")));++ String jsonOfCommits = CommitGraphUtils.asJSON(commitsModel.getObject());+ String script = String.format("gitplex.commitgraph.render('%s', %s);", container.getMarkupId(), jsonOfCommits);+ response.render(OnDomReadyHeaderItem.forScript(script));}@Overridediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/commit-list.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/commit-list.cssindex 77f6f21295..6d6894ebfd 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/commit-list.css+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlist/commit-list.css@@ -1,35 +1,38 @@-.commit-list>ul {+.commit-list>div>ul {margin-bottom: 0;}-.commit-list>ul li {+.commit-list>div>ul li {padding: 4px 0;}-.commit-list>ul .commit>.avatar {+.commit-list>div>ul .commit>.avatar {margin-top: 4px;}-.commit-list>ul .hash-and-code {+.commit-list>div>ul .label {+ margin: 3px 0 0 4px;+}+.commit-list>div>ul .hash-and-code {text-align: right;margin-top: 10px;white-space: nowrap;}-.commit-list>ul a {+.commit-list>div>ul a {color: #555;}-.commit-list>ul a.summary {+.commit-list>div>ul a.summary {font-weight: bold;font-size: 15px;}-.commit-list>ul .detail {+.commit-list>div>ul .detail {padding-left: 8px;padding-right: 8px;}-.commit-list>ul .commit:hover {+.commit-list>div>ul .commit:hover, .commit-list>div>ul .commit.hover {background: #F7ECB9;}-.commit-list>ul .commit .contribution {+.commit-list>div>ul .commit .contribution {font-size: 12px;}-.commit-list>ul .message {+.commit-list>div>ul .message {margin-bottom: 4px;}.commit-list .date {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/model/CommitRefsModel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/model/CommitRefsModel.javanew file mode 100644index 0000000000..437efffb2b--- /dev/null+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/model/CommitRefsModel.java@@ -0,0 +1,50 @@+package com.pmease.gitplex.web.model;++import java.util.ArrayList;+import java.util.HashMap;+import java.util.List;+import java.util.Map;++import org.apache.wicket.model.IModel;+import org.apache.wicket.model.LoadableDetachableModel;+import org.eclipse.jgit.internal.storage.file.FileRepository;+import org.eclipse.jgit.lib.Ref;+import org.eclipse.jgit.revwalk.RevCommit;++import com.pmease.gitplex.core.entity.Depot;++public class CommitRefsModel extends LoadableDetachableModel<Map<String, List<String>>> {++ private static final long serialVersionUID = 1L;++ private final IModel<Depot> depotModel;++ public CommitRefsModel(IModel<Depot> depotModel) {+ this.depotModel = depotModel;+ }++ @Override+ protected Map<String, List<String>> load() {+ Depot depot = depotModel.getObject();+ Map<String, List<String>> labels = new HashMap<>();+ List<Ref> refs = depot.getBranchRefs();+ refs.addAll(depot.getTagRefs());+ for (Ref ref: refs) {+ RevCommit commit = depot.getRevCommit(ref.getObjectId());+ List<String> commitLabels = labels.get(commit.name());+ if (commitLabels == null) {+ commitLabels = new ArrayList<>();+ labels.put(commit.name(), commitLabels);+ }+ commitLabels.add(FileRepository.shortenRefName(ref.getName()));+ }+ return labels;+ }++ @Override+ protected void onDetach() {+ depotModel.detach();+ super.onDetach();+ }++}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.javaindex b563ebae7d..3d82c53a5f 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java@@ -477,7 +477,8 @@ public class DepotBranchesPage extends DepotPage {PageParameters params = RevisionComparePage.paramsOf(getDepot(),new DepotAndBranch(getDepot(), branch),- new DepotAndBranch(getDepot(), getBaseBranch()),+ new DepotAndBranch(getDepot(), getBaseBranch()),+ true,null);setResponsePage(RevisionComparePage.class, params);}@@ -538,6 +539,7 @@ public class DepotBranchesPage extends DepotPage {getDepot(),new DepotAndBranch(getDepot(), getBaseBranch()),new DepotAndBranch(getDepot(), branch),+ true,null);setResponsePage(RevisionComparePage.class, params);}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.htmlindex dd720148ad..55c37d7e99 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.html@@ -12,7 +12,6 @@<div wicket:id="feedback"></div></div><div wicket:id="body" class="body">- <svg class="lane"></svg><ul class="list list-unstyled"><li wicket:id="commits"></li></ul>diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.javaindex edbe81fd5a..c6c3e1f436 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.java@@ -2,12 +2,7 @@ package com.pmease.gitplex.web.page.depot.commit;import java.io.Serializable;import java.util.ArrayList;-import java.util.Collections;-import java.util.Comparator;-import java.util.HashMap;import java.util.List;-import java.util.Map;-import java.util.Stack;import java.util.regex.Pattern;import javax.annotation.Nullable;@@ -39,16 +34,11 @@ import org.apache.wicket.request.cycle.RequestCycle;import org.apache.wicket.request.mapper.parameter.PageParameters;import org.apache.wicket.request.resource.CssResourceReference;import org.apache.wicket.request.resource.JavaScriptResourceReference;-import org.eclipse.jgit.internal.storage.file.FileRepository;-import org.eclipse.jgit.lib.Ref;-import org.eclipse.jgit.revwalk.RevCommit;import org.joda.time.DateTime;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.unbescape.java.JavaEscape;-import com.fasterxml.jackson.core.JsonProcessingException;-import com.fasterxml.jackson.databind.ObjectMapper;import com.google.common.base.Optional;import com.google.common.base.Throwables;import com.pmease.commons.git.Commit;@@ -57,16 +47,18 @@ import com.pmease.commons.util.StringUtils;import com.pmease.commons.util.concurrent.PrioritizedCallable;import com.pmease.commons.wicket.ajaxlistener.IndicateLoadingListener;import com.pmease.commons.wicket.assets.clearable.ClearableResourceReference;-import com.pmease.commons.wicket.assets.snapsvg.SnapSvgResourceReference;import com.pmease.gitplex.core.GitPlex;import com.pmease.gitplex.core.entity.Depot;import com.pmease.gitplex.core.entity.component.DepotAndRevision;import com.pmease.gitplex.core.manager.WorkManager;import com.pmease.gitplex.web.Constants;+import com.pmease.gitplex.web.assets.commitgraph.CommitGraphResourceReference;+import com.pmease.gitplex.web.assets.commitgraph.CommitGraphUtils;import com.pmease.gitplex.web.component.avatar.ContributorAvatars;import com.pmease.gitplex.web.component.commitmessage.CommitMessagePanel;import com.pmease.gitplex.web.component.contributionpanel.ContributionPanel;import com.pmease.gitplex.web.component.hashandcode.HashAndCodePanel;+import com.pmease.gitplex.web.model.CommitRefsModel;import com.pmease.gitplex.web.page.depot.DepotPage;import com.pmease.gitplex.web.page.depot.commit.CommitQueryParser.CriteriaContext;import com.pmease.gitplex.web.page.depot.commit.CommitQueryParser.QueryContext;@@ -145,13 +137,13 @@ public class DepotCommitsPage extends DepotPage {for (int i=0; i<lastMaxCount; i++)commits.last.add(logCommits.get(i));- sort(commits.last, 0);+ CommitGraphUtils.sort(commits.last, 0);commits.current = new ArrayList<>(commits.last);for (int i=lastMaxCount; i<logCommits.size(); i++)commits.current.add(logCommits.get(i));- sort(commits.current, lastMaxCount);+ CommitGraphUtils.sort(commits.current, lastMaxCount);commits.last = separateByDate(commits.last);commits.current = separateByDate(commits.current);@@ -161,26 +153,7 @@ public class DepotCommitsPage extends DepotPage {};- private IModel<Map<String, List<String>>> labelsModel = new LoadableDetachableModel<Map<String, List<String>>>() {-- @Override- protected Map<String, List<String>> load() {- Map<String, List<String>> labels = new HashMap<>();- List<Ref> refs = getDepot().getBranchRefs();- refs.addAll(getDepot().getTagRefs());- for (Ref ref: refs) {- RevCommit commit = getDepot().getRevCommit(ref.getObjectId());- List<String> commitLabels = labels.get(commit.name());- if (commitLabels == null) {- commitLabels = new ArrayList<>();- labels.put(commit.name(), commitLabels);- }- commitLabels.add(FileRepository.shortenRefName(ref.getName()));- }- return labels;- }-- };+ private CommitRefsModel labelsModel = new CommitRefsModel(depotModel);public DepotCommitsPage(PageParameters params) {super(params);@@ -188,50 +161,6 @@ public class DepotCommitsPage extends DepotPage {state = new HistoryState(params);}- private void sort(List<Commit> commits, int from) {- final Map<String, Long> hash2index = new HashMap<>();- Map<String, Commit> hash2commit = new HashMap<>();- for (int i=0; i<commits.size(); i++) {- Commit commit = commits.get(i);- hash2index.put(commit.getHash(), 1L*i*commits.size());- hash2commit.put(commit.getHash(), commit);- }-- Stack<Commit> stack = new Stack<>();-- for (int i=commits.size()-1; i>=from; i--)- stack.push(commits.get(i));-- // commits are nearly ordered, so this should be fast- while (!stack.isEmpty()) {- Commit commit = stack.pop();- long commitIndex = hash2index.get(commit.getHash());- int count = 1;- for (String parentHash: commit.getParentHashes()) {- Long parentIndex = hash2index.get(parentHash);- if (parentIndex != null && parentIndex.longValue()<commitIndex) {- stack.push(hash2commit.get(parentHash));- hash2index.put(parentHash, commitIndex+(count++));- }- }- }-- Collections.sort(commits, new Comparator<Commit>() {-- @Override- public int compare(Commit o1, Commit o2) {- long value = hash2index.get(o1.getHash()) - hash2index.get(o2.getHash());- if (value < 0)- return -1;- else if (value > 0)- return 1;- else- return 0;- }-- });- }-private Component replaceItem(AjaxRequestTarget target, int index) {Component item = commitsView.get(index);Component newItem = newCommitItem(item.getId(), index);@@ -372,8 +301,7 @@ public class DepotCommitsPage extends DepotPage {target.prependJavaScript(builder);target.add(feedback);target.add(foot);- String script = String.format("gitplex.repocommits.onCommitsLoaded(%s);", getCommitsJson());- target.appendJavaScript(script);+ target.appendJavaScript(renderCommitGraph());pushState(target);}@@ -402,12 +330,8 @@ public class DepotCommitsPage extends DepotPage {target.add(feedback);body.replace(commitsView = newCommitsView());target.add(body);-target.add(foot);-- String script = String.format("gitplex.repocommits.onCommitsLoaded(%s);", getCommitsJson());- target.appendJavaScript(script);-+ target.appendJavaScript(renderCommitGraph());pushState(target);}@@ -511,7 +435,8 @@ public class DepotCommitsPage extends DepotPage {if (state.getCompareWith() != null) {PageParameters params = RevisionComparePage.paramsOf(getDepot(),new DepotAndRevision(getDepot(), commit.getHash()),- new DepotAndRevision(getDepot(), state.getCompareWith()), path);+ new DepotAndRevision(getDepot(), state.getCompareWith()),+ true, path);item.add(new BookmarkablePageLink<Void>("compare", RevisionComparePage.class, params));} else {item.add(new WebMarkupContainer("compare").setVisible(false));@@ -556,11 +481,14 @@ public class DepotCommitsPage extends DepotPage {body.replace(commitsView = newCommitsView());target.add(body);-target.add(foot);-- String script = String.format("gitplex.repocommits.onCommitsLoaded(%s);", getCommitsJson());- target.appendJavaScript(script);++ target.appendJavaScript(renderCommitGraph());+ }++ private String renderCommitGraph() {+ String jsonOfCommits = CommitGraphUtils.asJSON(commitsModel.getObject().current);+ return String.format("gitplex.commitgraph.render('%s', %s);", body.getMarkupId(), jsonOfCommits);}@Override@@ -571,34 +499,6 @@ public class DepotCommitsPage extends DepotPage {super.onDetach();}- private String getCommitsJson() {- List<Commit> commits = commitsModel.getObject().current;- Map<String, Integer> hash2index = new HashMap<>();- int commitIndex = 0;- for (int i=0; i<commits.size(); i++) {- Commit commit = commits.get(i);- if (commit != null)- hash2index.put(commit.getHash(), commitIndex++);- }- List<List<Integer>> commitIndexes = new ArrayList<>();- for (Commit commit: commits) {- if (commit != null) {- List<Integer> parentIndexes = new ArrayList<>();- for (String parentHash: commit.getParentHashes()) {- Integer parentIndex = hash2index.get(parentHash);- if (parentIndex != null)- parentIndexes.add(parentIndex);- }- commitIndexes.add(parentIndexes);- }- }- try {- return GitPlex.getInstance(ObjectMapper.class).writeValueAsString(commitIndexes);- } catch (JsonProcessingException e) {- throw new RuntimeException(e);- }- }-private List<Commit> separateByDate(List<Commit> commits) {List<Commit> separated = new ArrayList<>();DateTime groupTime = null;@@ -619,14 +519,13 @@ public class DepotCommitsPage extends DepotPage {super.renderHead(response);response.render(JavaScriptHeaderItem.forReference(ClearableResourceReference.INSTANCE));- response.render(JavaScriptHeaderItem.forReference(SnapSvgResourceReference.INSTANCE));+ response.render(JavaScriptHeaderItem.forReference(CommitGraphResourceReference.INSTANCE));response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(DepotCommitsPage.class, "depot-commits.js")));response.render(CssHeaderItem.forReference(new CssResourceReference(DepotCommitsPage.class, "depot-commits.css")));- String script = String.format("gitplex.repocommits.init(%s);", getCommitsJson());- response.render(OnDomReadyHeaderItem.forScript(script));+ response.render(OnDomReadyHeaderItem.forScript(renderCommitGraph()));}/*diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/depot-commits.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/depot-commits.cssindex 70b3dd0d04..8c3bc47f37 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/depot-commits.css+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/depot-commits.css@@ -53,9 +53,6 @@#repo-commits>.body>.list {margin-bottom: 0;}-#repo-commits>.body>.lane {- position: absolute;-}#repo-commits>.foot {text-align: center;}@@ -69,109 +66,3 @@text-align: left;border-bottom: 1px solid #EEE;}--.commit-dot {- fill: #53a8fd;- stroke: #53a8fd;-}-.commit-line {- stroke-width: 1px;- stroke: #53a8fd;- fill: none;-}--.commit-dot-color1 {- fill: #53a8fd;- stroke: #53a8fd;-}-.commit-line-color1 {- stroke: #53a8fd;-}--.commit-dot-color2 {- fill: #09c112;- stroke: #09c112;-}-.commit-line-color2 {- stroke: #09c112;-}--.commit-dot-color3 {- fill: #ff4242;- stroke: #ff4242;-}-.commit-line-color3 {- stroke: #ff4242;-}--.commit-dot-color4 {- fill: #0252a2;- stroke: #0252a2;-}-.commit-line-color4 {- stroke: #0252a2;-}--.commit-dot-color5 {- fill: #056d0b;- stroke: #056d0b;-}-.commit-line-color5 {- stroke: #056d0b;-}--.commit-dot-color6 {- fill: #b00000;- stroke: #b00000;-}-.commit-line-color6 {- stroke: #b00000;-}--.commit-dot-color7 {- fill: #af29f8;- stroke: #af29f8;-}-.commit-line-color7 {- stroke: #af29f8;-}--.commit-dot-color8 {- fill: #ee6c1e;- stroke: #ee6c1e;-}-.commit-line-color8 {- stroke: #ee6c1e;-}--.commit-dot-color9 {- fill: #ef56cd;- stroke: #ef56cd;-}-.commit-line-color9 {- stroke: #ef56cd;-}--.commit-dot-color10 {- fill: #630596;- stroke: #630596;-}-.commit-line-color10 {- stroke: #630596;-}--.commit-dot-color11 {- fill: #8e4509;- stroke: #8e4509;-}-.commit-line-color11 {- stroke: #8e4509;-}--.commit-dot-color12 {- fill: #9b0f7b;- stroke: #9b0f7b;-}-.commit-line-color12 {- stroke: #9b0f7b;-}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/depot-commits.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/depot-commits.jsindex 7521a121c6..ed33b84356 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/depot-commits.js+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/depot-commits.js@@ -1,12 +1,4 @@gitplex.repocommits = {- init: function(commits) {- $(window).resize(function(e) {- e.stopPropagation();- gitplex.repocommits.drawCommitLane();- });- gitplex.repocommits.onCommitsLoaded(commits);- },-initQuery: function() {var $queryForm = $("#repo-commits>.head>.query");var $queryInput = $queryForm.find(".input-group>input");@@ -15,425 +7,5 @@ gitplex.repocommits = {if (!$queryInput.is(":focus"))$queryForm.find("button[type='submit']").click();});- },-- /*- * commits is an array of ordered commit object, and the commit object is itself a- * list of parent indexes- */- onCommitsLoaded: function(commits) {- var columnsLimit = 12;-- var colorsLimit = 12;-- /*- * rows store the map of line to row. A line represents a child->parent relationship.- * For instance line(1,5) represents the line from commit at row 1 (the child ) to- * commit at row 5 (the parent). In case child row index equals parent row index,- * the line represents a commit.- *- */- var rows = [];- var parent2children = {};- var colors = {};-- var colorStack = [];- function getSortedLines(row, reverse) {- var lines = [];- var keys = Object.keys(row);- for (var i in keys)- lines.push(keys[i]);-- lines.sort(function(x, y) {- if (reverse)- return row[y] - row[x];- else- return row[x] - row[y];- });- return lines;- }-- function fromKey(lineKey) {- return lineKey.split(',').map(function(item) {- return parseInt(item, 10);- });- }-- function toKey(line) {- return line[0] + "," + line[1];- }-- function assignColor(lineKey) {- var color = colors[lineKey];- if (color == undefined) {- if (colorStack.length == 0) {- for (var i=colorsLimit; i>=1; i--)- colorStack.push(i);- }- color = colorStack.pop();- colors[lineKey] = color;- }- return color;- }-- for (var i in commits) {- commits[i] = commits[i][1];- var parents = commits[i];- for (var j in parents) {- var parent = parents[j];- var children = parent2children[parent];- if (children == undefined) {- children = [];- parent2children[parent] = children;- }- children.push(i);- }- }-- for (var rowIndex in commits) {- var row = {};- if (rowIndex == 0) {- row["0,0"] = 0;- } else {- var parents = commits[rowIndex-1];- // special line represents the commit at rowIndex itself- var commitLineKey = toKey([rowIndex, rowIndex]);- var lastRow = rows[rowIndex-1];- var column = 0;- var linesOfLastRow = getSortedLines(lastRow, false);- for (var i in linesOfLastRow) {- var lineOfLastRow = fromKey(linesOfLastRow[i]);- if (lineOfLastRow[1] < 0) // line is cutted due to max columns limitation- continue;- if (lineOfLastRow[1] != lineOfLastRow[0]) { // not a commit point- // line not started from last row, in this case, the line- // only occupies a column when it goes through current row- if (lineOfLastRow[1] == rowIndex) {- if (row[commitLineKey] == undefined)- row[commitLineKey] = column++;- } else {- row[toKey(lineOfLastRow)] = column++;- }- } else {- for (var j in parents) {- var parent = parents[j];- if (parent == rowIndex) {- if (row[commitLineKey] == undefined)- row[commitLineKey] = column++;- } else {- row[toKey([rowIndex-1, parent])] = column++;- }- }- }- }-- if (row[commitLineKey] == undefined)- row[commitLineKey] = column++;- if (column > columnsLimit) {- var reversedLines = getSortedLines(row, true);- for (var i in reversedLines) {- var line = fromKey(reversedLines[i]);- if (line[0] == rowIndex-1) {- var cuttedLine = [line[0], line[1]*-1];- var lineKey = toKey(line);- var lineColumn = row[lineKey];- delete row[lineKey];- row[toKey(cuttedLine)] = lineColumn;- column--;- if (column == columnsLimit)- break;- }- }- if (column != columnsLimit)- throw "Error calculating commit lane at row " + rowIndex;- }-- var cuttedLines = [];- var children = parent2children[rowIndex];- if (children) {- for (var i in children) {- var child = children[i];- if (child != rowIndex-1) {- var line = [child, rowIndex];- var cuttedLine = [child, rowIndex*-1];- var lineKey = toKey(line);- var cuttedLineKey = toKey(cuttedLine);- if (lastRow[lineKey] == undefined) {- if (lastRow[cuttedLineKey] != undefined) {- var cuttedLineColumn = lastRow[cuttedLineKey];- delete lastRow[cuttedLineKey];- lastRow[lineKey] = cuttedLineColumn;- } else {- cuttedLines.push(cuttedLine);- }- }- }- }- }- if (cuttedLines.length != 0) {- // for every disappeared line, we need to make them appear again in last row- // so that end part of the line can be drawn from last row to this row.- // Below code find column in last row to insert these appeared lines, and- // we want to make sure that this column can result in minimum line crossovers.- var commitColumn = row[commitLineKey];- var insertColumn = 0;- for (var i=linesOfLastRow.length-1; i>=0; i--) {- var lineOfLastRowKey = linesOfLastRow[i];- var lineOfLastRow = fromKey(lineOfLastRowKey);- if (lineOfLastRow[0] == lineOfLastRow[1]) {- var found = false;- for (var j in parents) {- var parent = parents[j];- var lineKey = toKey([rowIndex-1, parent]);- var lineColumn = row[lineKey];- if (lineColumn != undefined) {- if (lineColumn<commitColumn) {- found = true;- break;- }- } else {- lineKey = toKey([rowIndex-1, parent*-1]);- lineColumn = row[lineKey];- if (lineColumn != undefined && lineColumn<commitColumn) {- found = true;- break;- }- }- }- if (found) {- insertColumn = i;- break;- }- } else {- var lineColumn = row[lineOfLastRowKey];- if (lineColumn!=undefined && lineColumn<commitColumn) {- insertColumn = i;- break;- }- }- }- column = insertColumn+1;- for (var i in cuttedLines)- lastRow[toKey(cuttedLines[i])] = column++;- for (var i=insertColumn+1; i<linesOfLastRow.length; i++)- lastRow[linesOfLastRow[i]] = column++;- }- }- rows.push(row);- }- for (var i=1; i<rows.length; i++) {- var row = rows[i];- var lastRow = rows[i-1];- var lines = getSortedLines(row, false);- var lastLines = getSortedLines(lastRow, true);-- var recycledColors = [];-- for (var j in lines) {- var line = fromKey(lines[j]);- if (line[0] == line[1]) {- for (var k in lastLines) {- var lastLine = fromKey(lastLines[k]);- if (lastLine[0] == lastLine[1]) {- if (commits[i-1].indexOf(i) != -1)- recycledColors.push(assignColor(toKey([i-1, i])));- } else if (lastLine[1] == i) {- recycledColors.push(assignColor(toKey(lastLine)));- } else if (lastLine[1]*-1 == i) {- recycledColors.push(assignColor(toKey([lastLine[0], i])));- }- }- } else {- if (line[1] < 0)- assignColor(toKey([line[0], line[1]*-1]));- else- assignColor(toKey(line));- }- }- for (var j in recycledColors)- colorStack.push(recycledColors[j]);- }- gitplex.repocommits.rows = rows;- gitplex.repocommits.commits = commits;- gitplex.repocommits.parent2children = parent2children;- gitplex.repocommits.colors = colors;-- gitplex.repocommits.drawCommitLane();-- var paper = Snap("#repo-commits>.body>.lane");- function getCommitDot(e) {- var $target = $(e.target);- if (!$target.hasClass("commit") || !$target.is("li"))- $target = $target.closest("li.commit");- var index = $target.attr("class").split(" ").pop().split("-").pop();- return paper.select("#commit-dot-" + index);- }- function onMouseEnter(e) {- getCommitDot(e).attr("strokeWidth", 3);- }- function onMouseLeave(e) {- getCommitDot(e).attr("strokeWidth", 0);- }- var $commits = $("#repo-commits li.commit");- $commits.off("mouseenter");- $commits.off("mouseleave");- $commits.mouseenter(onMouseEnter);- $commits.mouseleave(onMouseLeave);- },- drawCommitLane: function() {- var columnWidth = 12;- var topOffset = 22;- var rightOffset = 12;- var dotSize = 3;-- var dotColorClass = "commit-dot-color";- var lineColorClass = "commit-line-color";-- var rows = gitplex.repocommits.rows;- var commits = gitplex.repocommits.commits;- var parent2children = gitplex.repocommits.parent2children;- var colors = gitplex.repocommits.colors;-- var maxColumns = 0;- for (var i in rows) {- var columns = Object.keys(rows[i]).length;- if (columns > maxColumns)- maxColumns = columns;- }-- function fromKey(lineKey) {- return lineKey.split(',').map(function(item) {- return parseInt(item, 10);- });- }-- function toKey(line) {- return line[0] + "," + line[1];- }-- var bodyTop = $("#repo-commits>.body").offset().top - topOffset;-- function getTop(row) {- return $(".commit-item-"+row).offset().top - bodyTop;- }-- function getLeft(column) {- return column*columnWidth + columnWidth/2;- }-- var $list = $("#repo-commits>.body>.list");- $list.css("margin-left", maxColumns*columnWidth+rightOffset);-- var $lane = $("#repo-commits>.body>.lane");- $lane.empty();- $lane.height($list.outerHeight());- $lane.width(maxColumns*columnWidth);- var paper = Snap($lane[0]);-- for (var i=0; i<commits.length; i++) {- var parents = commits[i];- var row = rows[i];-- var column = row[toKey([i, i])];- var left = getLeft(column);- var top = getTop(i);-- if (i != commits.length-1) {- var nextRow = rows[i+1];- var nextTop = getTop(i+1);- for (var lineKey in row) {- var line = fromKey(lineKey);- column = row[lineKey];-- function drawLine(nextColumn, color, upArrow, downArrow) {- if (nextColumn != undefined) {- var arrowOffset = 10;- var arrowWidth = 4;- var arrowHeight = 8;- var left = getLeft(column);- var nextLeft = getLeft(nextColumn);- var line = paper.line(left, top, nextLeft, nextTop);- line.addClass("commit-line");- line.addClass(lineColorClass + color);- var arrow;- if (upArrow) {- arrow = paper.path("M" + left + " " + top + "l0 -" + arrowOffset- + "l-" + arrowWidth + " " + arrowHeight + "m" + arrowWidth*2- + " 0l-" + arrowWidth + " -" + arrowHeight);- } else if (downArrow) {- arrow = paper.path("M" + nextLeft + " " + nextTop + "l0 " + arrowOffset- + "l-" + arrowWidth + " -" + arrowHeight + "m" + arrowWidth*2- + " 0l-" + arrowWidth + " " + arrowHeight);- }- if (arrow) {- arrow.addClass("commit-line");- arrow.addClass(lineColorClass + color);- }- }- }-- if (line[0] == line[1]) {- for (var j in parents) {- var parent = parents[j];- if (parent == i+1) {- drawLine(nextRow[toKey([i+1, i+1])], colors[toKey([i, i+1])]);- } else {- var nextLineKey = toKey([i, parent]);- var nextColumn = nextRow[nextLineKey];- if (nextColumn != undefined) {- drawLine(nextColumn, colors[nextLineKey], false, false);- } else {- var nextCuttedLineKey = toKey([i, -1*parent]);- drawLine(nextRow[nextCuttedLineKey], colors[nextLineKey], false, true);- }- }- }- } else {- if (line[1] < 0) {- if (line[1]*-1 == i+1) {- var nextColumn = nextRow[toKey([i+1, i+1])];- drawLine(nextColumn, colors[toKey([line[0], i+1])], true, false);- }- } else if (line[1] == i+1){- var nextColumn = nextRow[toKey([i+1, i+1])];- drawLine(nextColumn, colors[lineKey], false, false);- } else {- drawLine(nextRow[lineKey], colors[lineKey], false, false);- }- }- }- }- }-- for (var i in commits) {- var parents = commits[i];- var row = rows[i];-- var column = row[toKey([i, i])];- var left = getLeft(column);- var top = getTop(i);- var circle = paper.circle(left, top, dotSize);- circle.addClass("commit-dot");- if (parents.length != 0) {- circle.addClass(dotColorClass + colors[toKey([i, parents[0]])]);- } else {- var children = parent2children[i];- if (children && children.length != 0)- circle.addClass(dotColorClass + colors[toKey([children[0], i])]);- }- circle.attr("id", "commit-dot-" + i);- circle.mouseover(function() {- this.attr("strokeWidth", 4);- var index = this.attr("id").split("-").pop();- $(".commit-item-" + index).addClass("hover");- });- circle.mouseout(function() {- this.attr("strokeWidth", 0);- var index = this.attr("id").split("-").pop();- $(".commit-item-" + index).removeClass("hover");- });- }-}-}\ No newline at end of filediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/RevisionComparePage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/RevisionComparePage.htmlindex 2172869834..0874c1ac9f 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/RevisionComparePage.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/RevisionComparePage.html@@ -4,14 +4,17 @@<div class="body"><div class="revisions clearfix"><div class="revision pull-left">- <label>Base</label>+ <label class="pull-left">Left side</label>+ <input type="checkbox"></input>+ <span>common ancestor</span>+ <a wicket:id="tooltip"><i class="fa fa-question-circle"></i></a><div wicket:id="target"></div></div><div class="action pull-left">- <a wicket:id="swap" class="swap btn btn-default" title="Swap"><i class="fa fa-ellipsis-h"></i></a>+ <a wicket:id="swap" class="swap btn btn-default" title="Swap"><i class="fa fa-arrows-h"></i></a></div><div class="revision pull-left">- <label>Compare</label>+ <label>Right side</label><div wicket:id="source"></div></div></div>diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/RevisionComparePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/RevisionComparePage.javaindex 5af5224756..0da2d428bc 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/RevisionComparePage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/RevisionComparePage.java@@ -25,6 +25,7 @@ import org.apache.wicket.request.resource.CssResourceReference;import com.pmease.commons.git.Commit;import com.pmease.commons.git.Git;+import com.pmease.commons.git.command.LogCommand;import com.pmease.commons.util.FileUtils;import com.pmease.commons.util.StringUtils;import com.pmease.commons.wicket.behavior.StickyBehavior;@@ -50,12 +51,16 @@ import com.pmease.gitplex.web.page.depot.pullrequest.newrequest.NewRequestPage;import com.pmease.gitplex.web.page.depot.pullrequest.requestdetail.RequestDetailPage;import com.pmease.gitplex.web.page.depot.pullrequest.requestdetail.overview.RequestOverviewPage;+import jersey.repackaged.com.google.common.collect.Lists;+@SuppressWarnings("serial")public class RevisionComparePage extends DepotPage {- private static final String PARAM_TARGET = "target";+ private static final String PARAM_LEFT = "left";++ private static final String PARAM_RIGHT = "right";- private static final String PARAM_SOURCE = "source";+ private static final String PARAM_COMPARE_WITH_MERGE_BASE = "compareWithMergeBase";private static final String PARAM_PATH = "path";@@ -67,9 +72,9 @@ public class RevisionComparePage extends DepotPage {private IModel<String> mergeBaseModel;- private DepotAndRevision target;+ private DepotAndRevision rightSide;- private DepotAndRevision source;+ private DepotAndRevision leftSide;private DiffOptionPanel diffOption;@@ -77,13 +82,16 @@ public class RevisionComparePage extends DepotPage {private AjaxActionTab filesTab;+ private boolean compareWithMergeBase;+private String path;public static PageParameters paramsOf(Depot depot, DepotAndRevision target,- DepotAndRevision source, @Nullable String path) {+ DepotAndRevision source, boolean compareWithMergeBase, @Nullable String path) {PageParameters params = paramsOf(depot);- params.set(PARAM_TARGET, target.toString());- params.set(PARAM_SOURCE, source.toString());+ params.set(PARAM_LEFT, target.toString());+ params.set(PARAM_RIGHT, source.toString());+ params.set(PARAM_COMPARE_WITH_MERGE_BASE, compareWithMergeBase);if (path != null)params.set(PARAM_PATH, path);return params;@@ -95,28 +103,30 @@ public class RevisionComparePage extends DepotPage {if (!getDepot().git().hasRefs())throw new RestartResponseException(NoCommitsPage.class, paramsOf(getDepot()));- String str = params.get(PARAM_SOURCE).toString();+ String str = params.get(PARAM_RIGHT).toString();if (str != null) {- source = new DepotAndRevision(str);+ leftSide = new DepotAndRevision(str);} else {- source = new DepotAndRevision(getDepot(), getDepot().getDefaultBranch());+ leftSide = new DepotAndRevision(getDepot(), getDepot().getDefaultBranch());}- str = params.get(PARAM_TARGET).toString();+ str = params.get(PARAM_LEFT).toString();if (str != null) {- target = new DepotAndRevision(str);+ rightSide = new DepotAndRevision(str);} else {- target = new DepotAndRevision(getDepot(), getDepot().getDefaultBranch());+ rightSide = new DepotAndRevision(getDepot(), getDepot().getDefaultBranch());}+ compareWithMergeBase = params.get(PARAM_COMPARE_WITH_MERGE_BASE).toBoolean(false);+path = params.get(PARAM_PATH).toString();requestModel = new LoadableDetachableModel<PullRequest>() {@Overrideprotected PullRequest load() {- DepotAndBranch target = new DepotAndBranch(RevisionComparePage.this.target.toString());- DepotAndBranch source = new DepotAndBranch(RevisionComparePage.this.source.toString());+ DepotAndBranch target = new DepotAndBranch(rightSide.toString());+ DepotAndBranch source = new DepotAndBranch(leftSide.toString());return GitPlex.getInstance(PullRequestManager.class).findOpen(target, source);}@@ -126,20 +136,20 @@ public class RevisionComparePage extends DepotPage {@Overrideprotected String load() {- Depot targetDepot = target.getDepot();- Depot sourceDepot = source.getDepot();+ Depot targetDepot = rightSide.getDepot();+ Depot sourceDepot = leftSide.getDepot();if (!targetDepot.equals(sourceDepot)) {Git sandbox = new Git(FileUtils.createTempDir());try {- sandbox.clone(targetDepot.git(), false, true, true, target.getRevision());+ sandbox.clone(targetDepot.git(), false, true, true, rightSide.getRevision());sandbox.reset(null, null);- sandbox.fetch(sourceDepot.git(), source.getRevision());- return sandbox.calcMergeBase(target.getCommit().name(), source.getCommit().name());+ sandbox.fetch(sourceDepot.git(), leftSide.getRevision());+ return sandbox.calcMergeBase(rightSide.getCommit().name(), leftSide.getCommit().name());} finally {FileUtils.deleteDir(sandbox.depotDir());}} else {- return targetDepot.getMergeBase(target.getRevision(), source.getRevision()).name();+ return targetDepot.getMergeBase(rightSide.getRevision(), leftSide.getRevision()).name();}}@@ -149,9 +159,17 @@ public class RevisionComparePage extends DepotPage {@Overrideprotected List<Commit> load() {- Depot sourceDepot = source.getDepot();- List<Commit> commits = sourceDepot.git().log(mergeBaseModel.getObject(),- source.getCommit().name(), null, 0, 0, false);+ Depot sourceDepot = leftSide.getDepot();+ LogCommand log = new LogCommand(sourceDepot.git().depotDir());+ List<Commit> commits;+ if (!compareWithMergeBase) {+ String revisions = rightSide.getRevision() + "..." + leftSide.getRevision();+ commits = log.revisions(Lists.newArrayList(revisions)).call();+ commits.add(sourceDepot.git().showRevision(mergeBaseModel.getObject()));+ } else {+ commits = sourceDepot.git().log(rightSide.getRevision(), leftSide.getRevision(), null, 0, 0, false);+ }+return commits;}@@ -165,22 +183,23 @@ public class RevisionComparePage extends DepotPage {setOutputMarkupId(true);- add(new AffinalRevisionPicker("target", target.getDepotId(), target.getRevision()) {+ add(new AffinalRevisionPicker("target", rightSide.getDepotId(), rightSide.getRevision()) {@Overrideprotected void onSelect(AjaxRequestTarget target, Depot depot, String revision) {- PageParameters params = paramsOf(getDepot(), new DepotAndRevision(depot, revision), source, path);+ PageParameters params = paramsOf(getDepot(), new DepotAndRevision(depot, revision),+ leftSide, compareWithMergeBase, path);setResponsePage(RevisionComparePage.class, params);}});- add(new AffinalRevisionPicker("source", source.getDepotId(), source.getRevision()) {+ add(new AffinalRevisionPicker("source", leftSide.getDepotId(), leftSide.getRevision()) {@Overrideprotected void onSelect(AjaxRequestTarget target, Depot depot, String revision) {- PageParameters params = paramsOf(getDepot(), RevisionComparePage.this.target,- new DepotAndRevision(depot, revision), path);+ PageParameters params = paramsOf(getDepot(), rightSide,+ new DepotAndRevision(depot, revision), compareWithMergeBase, path);setResponsePage(RevisionComparePage.class, params);}@@ -190,7 +209,8 @@ public class RevisionComparePage extends DepotPage {@Overridepublic void onClick() {- setResponsePage(RevisionComparePage.class,paramsOf(getDepot(), source, target, path));+ setResponsePage(RevisionComparePage.class,paramsOf(getDepot(),+ leftSide, rightSide, compareWithMergeBase, path));}});@@ -199,8 +219,8 @@ public class RevisionComparePage extends DepotPage {@Overridepublic void onClick() {- DepotAndBranch target = new DepotAndBranch(RevisionComparePage.this.target.toString());- DepotAndBranch source = new DepotAndBranch(RevisionComparePage.this.source.toString());+ DepotAndBranch target = new DepotAndBranch(rightSide.toString());+ DepotAndBranch source = new DepotAndBranch(leftSide.toString());setResponsePage(NewRequestPage.class, NewRequestPage.paramsOf(target.getDepot(), target, source));}@@ -208,7 +228,7 @@ public class RevisionComparePage extends DepotPage {protected void onConfigure() {super.onConfigure();- if (target.getBranch()!=null && source.getBranch()!=null) {+ if (rightSide.getBranch()!=null && leftSide.getBranch()!=null && compareWithMergeBase) {PullRequest request = requestModel.getObject();setVisible(request == null && !isIntegrated());} else {@@ -223,7 +243,7 @@ public class RevisionComparePage extends DepotPage {@Overrideprotected void onConfigure() {super.onConfigure();- setVisible(source.equals(target));+ setVisible(leftSide.equals(rightSide));}});@@ -233,8 +253,12 @@ public class RevisionComparePage extends DepotPage {protected void onConfigure() {super.onConfigure();- PullRequest request = requestModel.getObject();- setVisible(request != null);+ if (compareWithMergeBase) {+ PullRequest request = requestModel.getObject();+ setVisible(request != null);+ } else {+ setVisible(false);+ }}@Override@@ -279,7 +303,9 @@ public class RevisionComparePage extends DepotPage {protected void onConfigure() {super.onConfigure();- setVisible(!source.equals(target) && mergeBaseModel.getObject().equals(source.getCommit().name()));+ setVisible(!leftSide.equals(rightSide)+ && compareWithMergeBase+ && mergeBaseModel.getObject().equals(leftSide.getCommit().name()));}});@@ -324,7 +350,7 @@ public class RevisionComparePage extends DepotPage {}private boolean isIntegrated() {- return mergeBaseModel.getObject().equals(source.getCommit().name());+ return mergeBaseModel.getObject().equals(leftSide.getCommit().name());}@Override@@ -351,10 +377,10 @@ public class RevisionComparePage extends DepotPage {@Overridepublic Depot getObject() {- return RevisionComparePage.this.getDepot();+ return getDepot();}- }, RevisionComparePage.this.source.getRevision()) {+ }, leftSide.getRevision()) {@Overrideprotected void onSelectPath(AjaxRequestTarget target, String path) {@@ -405,7 +431,8 @@ public class RevisionComparePage extends DepotPage {private void newRevDiffPanel(final WebMarkupContainer tabPanel, @Nullable AjaxRequestTarget target) {RevisionDiffPanel diffPanel = new RevisionDiffPanel("revisionDiff", depotModel,new Model<PullRequest>(null), new Model<Comment>(null),- mergeBaseModel.getObject(), source.getRevision(),+ compareWithMergeBase?mergeBaseModel.getObject():rightSide.getRevision(),+ leftSide.getRevision(),StringUtils.isBlank(path)?null:path, null, diffOption.getLineProcessor(),diffOption.getDiffMode()) {@@ -427,7 +454,8 @@ public class RevisionComparePage extends DepotPage {}private void pushState(AjaxRequestTarget target) {- PageParameters params = paramsOf(getDepot(), RevisionComparePage.this.target, source, path);+ PageParameters params = paramsOf(getDepot(), rightSide, leftSide,+ compareWithMergeBase, path);CharSequence url = RequestCycle.get().urlFor(RevisionComparePage.class, params);pushState(target, url.toString(), path);}@@ -454,4 +482,5 @@ public class RevisionComparePage extends DepotPage {setResponsePage(DepotBranchesPage.class, paramsOf(depot));}+}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/revision-compare.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/revision-compare.cssindex c3b05bcf37..1fac998efc 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/revision-compare.css+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/revision-compare.css@@ -26,6 +26,13 @@color: #888;font-weight: normal;}+#revision-compare>.body>.revisions>.revision>input {+ margin-left: 16px;+}+#revision-compare>.body>.revisions>.revision>span {+ vertical-align: top;+ color: #888;+}#revision-compare>.body>.nav-tabs {margin-bottom: 20px;}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.javaindex 4bbfa22558..6cd9af1cbf 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java@@ -327,7 +327,7 @@ public class DepotTagsPage extends DepotPage {}DepotAndRevision source = new DepotAndRevision(getDepot(),GitUtils.ref2tag(item.getModelObject().getName()));- PageParameters params = RevisionComparePage.paramsOf(getDepot(), target, source, null);+ PageParameters params = RevisionComparePage.paramsOf(getDepot(), target, source, true, null);setResponsePage(RevisionComparePage.class, params);} catch (IOException e) {throw new RuntimeException(e);diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.htmlindex 795b443f3a..6c2576790c 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html@@ -1,3 +1,10 @@<wicket:extend><a wicket:id="test">test</a>+ <svg id="test"></svg>+ <ul class="test"></ul>+ <script type="text/javascript">+ $(window).resize(function() {+ console.log("resized");+ });+ </script></wicket:extend>\ No newline at end of filediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.javaindex bfcae9f2a8..54bf2e5039 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java@@ -1,11 +1,7 @@package com.pmease.gitplex.web.page.test;import org.apache.wicket.markup.html.link.Link;-import org.eclipse.jgit.lib.ObjectId;-import com.fasterxml.jackson.core.JsonProcessingException;-import com.fasterxml.jackson.databind.ObjectMapper;-import com.pmease.gitplex.core.GitPlex;import com.pmease.gitplex.web.page.base.BasePage;@SuppressWarnings("serial")@@ -19,14 +15,6 @@ public class TestPage extends BasePage {@Overridepublic void onClick() {- System.out.println(ObjectId.zeroId().name());- ObjectMapper mapper = GitPlex.getInstance(ObjectMapper.class);- try {- System.out.println(mapper.writeValueAsString(ObjectId.zeroId()));- } catch (JsonProcessingException e) {- // TODO Auto-generated catch block- e.printStackTrace();- }}});