The Unified and Autonomous Development Platform
midwork
robin shine009268a05898
diff --git a/commons.git/src/main/java/com/pmease/commons/git/CommitLane.java b/commons.git/src/main/java/com/pmease/commons/git/CommitLane.javadeleted file mode 100644index 92ec0eb941..0000000000--- a/commons.git/src/main/java/com/pmease/commons/git/CommitLane.java+++ /dev/null@@ -1,253 +0,0 @@-package com.pmease.commons.git;--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 org.apache.commons.lang3.builder.EqualsBuilder;-import org.apache.commons.lang3.builder.HashCodeBuilder;--import com.google.common.base.Preconditions;--@SuppressWarnings("serial")-public class CommitLane implements Serializable {-- /*- * Each list item represents a row, and each row represents a map of- * line to its drawn column at this row. With this info, one can- * go through each row to draw every child->parent line. Taking- * line (2,4) for instance, we first find commit column at row 2- * (by looking up the special line (2,2)), then find its column- * at row 3, and then find commit column at row 4 (by looking up the- * special line (4,4)). Finally connect these columns we got the- * line drawn.- */- private final List<Map<Line, Integer>> rows = new ArrayList<>();-- public CommitLane(List<Commit> commits, int maxColumns) {- Preconditions.checkArgument(!commits.isEmpty() && maxColumns>=1);-- Map<String, Integer> mapOfHashToRow = new HashMap<>();- Map<Integer, List<Integer>> mapOfParentToChildren = new HashMap<>();- for (int i=0; i<commits.size(); i++) {- Commit commit = commits.get(i);- mapOfHashToRow.put(commit.getHash(), i);- }- for (int i=0; i<commits.size(); i++) {- Commit commit = commits.get(i);- for (String parentHash: commit.getParentHashes()) {- Integer parent = mapOfHashToRow.get(parentHash);- if (parent != null) {- List<Integer> children = mapOfParentToChildren.get(parent);- if (children == null) {- children = new ArrayList<>();- mapOfParentToChildren.put(parent, children);- }- children.add(i);- }- }- }-- for (int rowIndex=0; rowIndex<commits.size(); rowIndex++) {- Map<Line, Integer> row = new HashMap<>();- if (rowIndex == 0) {- row.put(new Line(0, 0), 0);- } else {- // special line represents the commit at rowIndex itself- Line commitLine = new Line(rowIndex, rowIndex);- final Map<Line, Integer> lastRow = rows.get(rowIndex-1);- int column = 0;- List<Line> linesOfLastRow = getSortedLines(lastRow, false);- for (Line lineOfLastRow: linesOfLastRow) {- if (lineOfLastRow.isCutted()) // line is cutted due to max columns limitation- continue;- if (!lineOfLastRow.isCommit()) {- // line not started from last row, in this case, the line- // only occupies a column when it goes through current row- if (lineOfLastRow.parent == rowIndex) {- if (!row.containsKey(commitLine))- row.put(commitLine, column++);- } else {- row.put(lineOfLastRow, column++);- }- } else {- for (String parentHash: commits.get(rowIndex-1).getParentHashes()) {- Integer parent = mapOfHashToRow.get(parentHash);- if (parent != null) {- if (parent.intValue() == rowIndex) {- if (!row.containsKey(commitLine))- row.put(commitLine, column++);- } else {- row.put(new Line(rowIndex-1, parent), column++);- }- }- }- }- }- if (!row.containsKey(commitLine))- row.put(commitLine, column++);- if (column > maxColumns) {- for (Line line: getSortedLines(row, true)) {- if (line.child == rowIndex-1) {- row.put(line.toggle(), row.remove(line));- column--;- if (column == maxColumns)- break;- }- }- Preconditions.checkState(column == maxColumns);- }-- List<Line> cuttedLines = new ArrayList<>();- List<Integer> children = mapOfParentToChildren.get(rowIndex);- if (children != null) {- for (int child: children) {- if (child != rowIndex-1) {- Line line = new Line(child, rowIndex);- Line cuttedLine = line.toggle();- if (!lastRow.containsKey(line)) {- if (lastRow.containsKey(cuttedLine))- lastRow.put(line, lastRow.remove(cuttedLine));- else- cuttedLines.add(cuttedLine);- }- }- }- }- if (!cuttedLines.isEmpty()) {- // 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.- int commitColumn = row.get(commitLine);- int insertColumn = 0;- for (int i=linesOfLastRow.size()-1; i>=0; i--) {- Line lineOfLastRow = linesOfLastRow.get(i);- if (lineOfLastRow.isCommit()) {- boolean found = false;- for (String parentHash: commits.get(rowIndex-1).getParentHashes()) {- Integer parent = mapOfHashToRow.get(parentHash);- if (parent != null) {- Line line = new Line(rowIndex-1, parent);- Integer lineColumn = row.get(line);- if (lineColumn!=null && lineColumn.intValue()<commitColumn) {- found = true;- break;- }- }- }- if (found) {- insertColumn = i;- break;- }- } else {- Integer lineColumn = row.get(lineOfLastRow);- if (lineColumn!=null && lineColumn.intValue()<commitColumn) {- insertColumn = i;- break;- }- }- }- column = insertColumn+1;- for (Line cuttedLine: cuttedLines)- lastRow.put(cuttedLine, column++);- for (int i=insertColumn+1; i<linesOfLastRow.size(); i++)- lastRow.put(linesOfLastRow.get(i), column++);- }- }- rows.add(row);- }-- }-- private List<Line> getSortedLines(final Map<Line, Integer> row, boolean reverse) {- List<Line> lines = new ArrayList<>(row.keySet());- Collections.sort(lines, new Comparator<Line>() {-- @Override- public int compare(Line line1, Line line2) {- return row.get(line1) - row.get(line2);- }-- });- if (reverse)- Collections.reverse(lines);- return lines;- }-- public List<Map<Line, Integer>> getRows() {- return rows;- }-- /**- * 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.- *- * @author robin- *- */- public static class Line implements Serializable {-- private final int child;-- private final int parent;-- public Line(int child, int parent) {- this.child = child;- this.parent = parent;- }-- public int getChild() {- return child;- }-- public int getParent() {- return parent;- }-- public boolean isCutted() {- return parent < 0;- }-- public boolean isCommit() {- return child == parent;- }-- public Line toggle() {- return new Line(child, parent*-1);- }-- @Override- public boolean equals(Object other) {- if (!(other instanceof Line))- return false;- if (this == other)- return true;- Line otherLine = (Line) other;- return new EqualsBuilder()- .append(child, otherLine.child)- .append(parent, otherLine.parent)- .isEquals();- }-- @Override- public int hashCode() {- return new HashCodeBuilder(17, 37)- .append(child)- .append(parent)- .toHashCode();- }-- @Override- public String toString() {- return child+","+parent;- }-- }-}diff --git a/commons.git/src/main/java/com/pmease/commons/git/GitUtils.java b/commons.git/src/main/java/com/pmease/commons/git/GitUtils.javaindex 9dfaff66c0..7780cab95d 100644--- a/commons.git/src/main/java/com/pmease/commons/git/GitUtils.java+++ b/commons.git/src/main/java/com/pmease/commons/git/GitUtils.java@@ -161,7 +161,6 @@ public class GitUtils {return joinPath(splitPath(path));}-/*** Convert a git reference name to branch name.*@@ -182,6 +181,26 @@ public class GitUtils {return Git.REFS_HEADS + branch;}+ /**+ * Convert a git reference name to tag name.+ *+ * @param refName+ * name of the git reference+ * @return+ * name of the tag, or <tt>null</tt> if specified ref+ * does not represent a tag+ */+ public static @Nullable String ref2tag(String refName) {+ if (refName.startsWith(Git.REFS_TAGS))+ return refName.substring(Git.REFS_TAGS.length());+ else+ return null;+ }++ public static String tag2ref(String tag) {+ return Git.REFS_HEADS + tag;+ }+public static BlobIdent getOldBlobIdent(DiffEntry diffEntry, String oldRev) {BlobIdent blobIdent;if (diffEntry.getChangeType() != ChangeType.ADD) {diff --git a/commons.git/src/test/java/com/pmease/commons/git/CommitLaneTest.java b/commons.git/src/test/java/com/pmease/commons/git/CommitLaneTest.javadeleted file mode 100644index c199805274..0000000000--- a/commons.git/src/test/java/com/pmease/commons/git/CommitLaneTest.java+++ /dev/null@@ -1,256 +0,0 @@-package com.pmease.commons.git;--import static org.junit.Assert.assertEquals;--import java.io.File;-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 org.junit.Test;--import com.pmease.commons.git.command.LogCommand;-import com.pmease.commons.git.command.LogCommand.Order;-import com.pmease.commons.git.command.MergeCommand.FastForwardMode;--public class CommitLaneTest extends AbstractGitTest {-- private void assertLine(CommitLane lane, int row, int child, int parent, int column) {- assertEquals((Integer)column, lane.getRows().get(row).get(new CommitLane.Line(child, parent)));- }-- @Test- public void testLinear() {- addFileAndCommit("file1", "", "file1");- addFileAndCommit("file2", "", "file2");- addFileAndCommit("file3", "", "file3");-- LogCommand logCommand = new LogCommand(git.repoDir()).order(Order.DATE);- CommitLane lane = new CommitLane(logCommand.call(), Integer.MAX_VALUE);-- assertEquals(3, lane.getRows().size());- assertLine(lane, 0, 0, 0, 0);- assertLine(lane, 1, 1, 1, 0);- assertLine(lane, 2, 2, 2, 0);-- lane = new CommitLane(logCommand.call(), 1);-- assertLine(lane, 0, 0, 0, 0);- assertLine(lane, 1, 1, 1, 0);- assertLine(lane, 2, 2, 2, 0);- }-- @Test- public void testNonFastForwardMerge() {- addFileAndCommit("file1", "", "file1");- git.checkout("master", "dev");- sleep();- addFileAndCommit("file2", "", "file2");- git.checkout("master", null);- git.merge("dev", FastForwardMode.NO_FF, null, null, null);-- LogCommand logCommand = new LogCommand(git.repoDir()).order(Order.DATE);- CommitLane lane = new CommitLane(logCommand.call(), Integer.MAX_VALUE);-- assertLine(lane, 0, 0, 0, 0);- assertLine(lane, 1, 0, 2, 0);- assertLine(lane, 1, 1, 1, 1);- assertLine(lane, 2, 2, 2, 0);-- lane = new CommitLane(logCommand.call(), 1);-- assertLine(lane, 0, 0, 0, 0);- assertLine(lane, 1, 0, 2, 0);- assertLine(lane, 1, 1, 1, 1);- assertLine(lane, 2, 2, 2, 0);- }-- private void sleep() {- try {- Thread.sleep(1000);- } catch (InterruptedException e) {- throw new RuntimeException(e);- }- }-- @Test- public void testMerge() {- addFileAndCommit("file1", "", "file1");- addFileAndCommit("file2", "", "file2");- git.checkout("master~1", "dev");- sleep();- addFileAndCommit("file3", "", "file3");- git.checkout("master", null);- git.merge("dev", null, null, null, null);-- LogCommand logCommand = new LogCommand(git.repoDir()).order(Order.DATE);- CommitLane lane = new CommitLane(logCommand.call(), Integer.MAX_VALUE);-- assertLine(lane, 0, 0, 0, 0);- assertLine(lane, 1, 0, 2, 0);- assertLine(lane, 1, 1, 1, 1);- assertLine(lane, 2, 2, 2, 0);- assertLine(lane, 2, 1, 3, 1);- assertLine(lane, 3, 3, 3, 0);-- lane = new CommitLane(logCommand.call(), 1);-- assertLine(lane, 0, 0, 0, 0);- assertLine(lane, 1, 0, 2, 0);- assertLine(lane, 1, 1, 1, 1);- assertLine(lane, 2, 1, 3, 0);- assertLine(lane, 2, 2, 2, 1);- assertLine(lane, 3, 3, 3, 0);- }-- @Test- public void testMultiHeads() {- addFileAndCommit("file1", "", "file1");- addFileAndCommit("file2", "", "file2");- addFileAndCommit("file3", "", "file3");- git.checkout("master~1", "dev");- addFileAndCommit("file4", "", "file4");-- LogCommand logCommand = new LogCommand(git.repoDir()).order(Order.DATE);- logCommand.allBranchesAndTags(true);- CommitLane lane = new CommitLane(logCommand.call(), Integer.MAX_VALUE);-- assertLine(lane, 0, 0, 0, 0);- assertLine(lane, 1, 0, 2, 0);- assertLine(lane, 1, 1, 1, 1);- assertLine(lane, 2, 2, 2, 0);- assertLine(lane, 3, 3, 3, 0);- }-- @Test- public void test() {- LogCommand log = new LogCommand(new File("w:\\temp\\gitplex_storage\\repositories\\1"));- log.maxCount(550);- log.allBranchesAndTags(true);-- List<Commit> commits = log.call();- 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>=0; 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;- }-- });-- new CommitLane(commits, 20);- }-- @Test- public void testCompexGraph() {- addFileAndCommit("i", "", "i");- git.checkout("master", "dev2");- addFileAndCommit("h", "", "h");- git.checkout("master", null);- git.merge("dev2", FastForwardMode.NO_FF, null, null, "g");- git.checkout("master~1", "dev3");- sleep();- addFileAndCommit("f", null, "f");- git.checkout("master~1", "dev1");- sleep();- addFileAndCommit("e", null, "e");- git.merge("dev2", FastForwardMode.NO_FF, null, null, "d");- git.merge("dev3", null, null, null, "c");- git.checkout("master", null);- sleep();- addFileAndCommit("b", "", "b");- git.merge("dev1", null, null, null, "a");-- LogCommand logCommand = new LogCommand(git.repoDir()).order(Order.DATE);- CommitLane lane = new CommitLane(logCommand.call(), Integer.MAX_VALUE);- assertLine(lane, 0, 0, 0, 0);- assertLine(lane, 1, 1, 1, 0);- assertLine(lane, 1, 0, 2, 1);- assertLine(lane, 2, 1, 6, 0);- assertLine(lane, 2, 2, 2, 1);- assertLine(lane, 3, 1, 6, 0);- assertLine(lane, 3, 3, 3, 1);- assertLine(lane, 3, 2, 5, 2);- assertLine(lane, 4, 1, 6, 0);- assertLine(lane, 4, 4, 4, 1);- assertLine(lane, 4, 3, 7, 2);- assertLine(lane, 4, 2, 5, 3);- assertLine(lane, 5, 1, 6, 0);- assertLine(lane, 5, 4, 8, 1);- assertLine(lane, 5, 3, 7, 2);- assertLine(lane, 5, 5, 5, 3);- assertLine(lane, 6, 6, 6, 0);- assertLine(lane, 6, 4, 8, 1);- assertLine(lane, 6, 3, 7, 2);- assertLine(lane, 6, 5, 8, 3);- assertLine(lane, 7, 6, 8, 0);- assertLine(lane, 7, 7, 7, 1);- assertLine(lane, 7, 4, 8, 2);- assertLine(lane, 7, 5, 8, 3);- assertLine(lane, 8, 8, 8, 0);-- lane = new CommitLane(logCommand.call(), 3);- assertLine(lane, 0, 0, 0, 0);- assertLine(lane, 1, 1, 1, 0);- assertLine(lane, 1, 0, 2, 1);- assertLine(lane, 2, 1, 6, 0);- assertLine(lane, 2, 2, 2, 1);- assertLine(lane, 3, 1, 6, 0);- assertLine(lane, 3, 3, 3, 1);- assertLine(lane, 3, 2, 5, 2);- assertLine(lane, 4, 1, 6, 0);- assertLine(lane, 4, 4, 4, 1);- assertLine(lane, 4, 3, -7, 2);- assertLine(lane, 4, 2, 5, 3);- assertLine(lane, 5, 1, 6, 0);- assertLine(lane, 5, 4, 8, 1);- assertLine(lane, 5, 5, 5, 2);- assertLine(lane, 6, 6, 6, 0);- assertLine(lane, 6, 3, -7, 1);- assertLine(lane, 6, 4, 8, 2);- assertLine(lane, 6, 5, 8, 3);- assertLine(lane, 7, 6, 8, 0);- assertLine(lane, 7, 7, 7, 1);- assertLine(lane, 7, 4, 8, 2);- assertLine(lane, 7, 5, 8, 3);- assertLine(lane, 8, 8, 8, 0);- }--}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.htmlindex 1437921008..95c36c6dbe 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.html@@ -17,9 +17,14 @@<span wicket:id="avatar"></span></div><div class="detail pull-left">- <div wicket:id="message"></div>- <div class="author">- <span wicket:id="name"></span> authored <span wicket:id="age"></span>+ <div wicket:id="message" class="message"></div>+ <div class="author-and-labels clearfix">+ <div class="author pull-left">+ <span wicket:id="name"></span> authored <span wicket:id="age"></span>+ </div>+ <div class="labels pull-left">+ <span wicket:id="labels" class="label label-default"></span>+ </div></div></div><div class="info pull-right">diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.javaindex 5ea1313114..5158b8bc6f 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.java@@ -29,6 +29,7 @@ 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.lib.Ref;import org.joda.time.DateTime;import org.joda.time.format.DateTimeFormat;import org.joda.time.format.DateTimeFormatter;@@ -36,6 +37,7 @@ import org.joda.time.format.DateTimeFormatter;import com.fasterxml.jackson.core.JsonProcessingException;import com.fasterxml.jackson.databind.ObjectMapper;import com.pmease.commons.git.Commit;+import com.pmease.commons.git.Git;import com.pmease.commons.git.GitUtils;import com.pmease.commons.git.command.LogCommand;import com.pmease.commons.wicket.assets.snapsvg.SnapSvgResourceReference;@@ -75,11 +77,11 @@ public class RepoCommitsPage extends RepositoryPage {private WebMarkupContainer foot;- private IModel<LastAndCurrentCommits> lastAndCurrentCommitsModel = new LoadableDetachableModel<LastAndCurrentCommits>() {+ private IModel<Commits> commitsModel = new LoadableDetachableModel<Commits>() {@Override- protected LastAndCurrentCommits load() {- LastAndCurrentCommits lastAndCurrentCommits = new LastAndCurrentCommits();+ protected Commits load() {+ Commits commits = new Commits();LogCommand log = new LogCommand(getRepository().git().repoDir());log.maxCount(state.step*COUNT);if (revisionHash != null)@@ -89,29 +91,51 @@ public class RepoCommitsPage extends RepositoryPage {if (state.path != null)log.path(state.path);- List<Commit> commits = log.call();+ List<Commit> logCommits = log.call();- hasMore = commits.size() == state.step*COUNT;+ hasMore = logCommits.size() == state.step*COUNT;int lastMaxCount = (state.step-1)*COUNT;- lastAndCurrentCommits.last = new ArrayList<>();+ commits.last = new ArrayList<>();for (int i=0; i<lastMaxCount; i++)- lastAndCurrentCommits.last.add(commits.get(i));+ commits.last.add(logCommits.get(i));- sort(lastAndCurrentCommits.last, 0);+ sort(commits.last, 0);- lastAndCurrentCommits.current = new ArrayList<>(lastAndCurrentCommits.last);- for (int i=lastMaxCount; i<commits.size(); i++)- lastAndCurrentCommits.current.add(commits.get(i));+ commits.current = new ArrayList<>(commits.last);+ for (int i=lastMaxCount; i<logCommits.size(); i++)+ commits.current.add(logCommits.get(i));- sort(lastAndCurrentCommits.current, lastMaxCount);+ sort(commits.current, lastMaxCount);- lastAndCurrentCommits.last = separateByDate(lastAndCurrentCommits.last);- lastAndCurrentCommits.current = separateByDate(lastAndCurrentCommits.current);+ commits.last = separateByDate(commits.last);+ commits.current = separateByDate(commits.current);- return lastAndCurrentCommits;+ return commits;+ }++ };++ 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<>();+ Map<String, Ref> refs = new HashMap<>();+ refs.putAll(getRepository().getRefs(Git.REFS_HEADS));+ refs.putAll(getRepository().getRefs(Git.REFS_TAGS));+ for (Map.Entry<String, Ref> entry: refs.entrySet()) {+ String commitHash = entry.getValue().getObjectId().name();+ List<String> commitLabels = labels.get(commitHash);+ if (commitLabels == null) {+ commitLabels = new ArrayList<>();+ labels.put(commitHash, commitLabels);+ }+ commitLabels.add(entry.getKey());+ }+ return labels;}};@@ -201,7 +225,7 @@ public class RepoCommitsPage extends RepositoryPage {public void onClick(AjaxRequestTarget target) {state.step++;- LastAndCurrentCommits commits = lastAndCurrentCommitsModel.getObject();+ Commits commits = commitsModel.getObject();int commitIndex = 0;int lastCommitIndex = 0;for (int i=0; i<commits.last.size(); i++) {@@ -274,7 +298,7 @@ public class RepoCommitsPage extends RepositoryPage {RepeatingView commitsView = new RepeatingView("commits");int commitIndex = 0;- List<Commit> commits = lastAndCurrentCommitsModel.getObject().current;+ List<Commit> commits = commitsModel.getObject().current;for (int i=0; i<commits.size(); i++) {Component item = newCommitItem(commitsView.newChildId(), i);if (commits.get(i) != null)@@ -290,7 +314,7 @@ public class RepoCommitsPage extends RepositoryPage {}private Component newCommitItem(String itemId, final int index) {- List<Commit> current = lastAndCurrentCommitsModel.getObject().current;+ List<Commit> current = commitsModel.getObject().current;Commit commit = current.get(index);Fragment item;@@ -302,11 +326,20 @@ public class RepoCommitsPage extends RepositoryPage {@Overrideprotected Commit load() {- return lastAndCurrentCommitsModel.getObject().current.get(index);+ return commitsModel.getObject().current.get(index);}}));+ 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));+ item.add(labelsView);+item.add(new PersonLink("name", Model.of(commit.getAuthor()), AvatarMode.NAME));item.add(new Label("age", DateUtils.formatAge(commit.getAuthor().getWhen())));@@ -316,6 +349,7 @@ public class RepoCommitsPage extends RepositoryPage {state.blobIdent.revision = commit.getHash();item.add(new BookmarkablePageLink<Void>("codeLink", RepoFilePage.class,RepoFilePage.paramsOf(repoModel.getObject(), state)));+item.add(AttributeAppender.append("class", "commit clearfix"));} else {item = new Fragment(itemId, "dateFrag", this);@@ -358,13 +392,14 @@ public class RepoCommitsPage extends RepositoryPage {@Overrideprotected void onDetach() {- lastAndCurrentCommitsModel.detach();+ commitsModel.detach();+ labelsModel.detach();super.onDetach();}private String getCommitsJson() {- List<Commit> commits = lastAndCurrentCommitsModel.getObject().current;+ List<Commit> commits = commitsModel.getObject().current;Map<String, Integer> hash2index = new HashMap<>();int commitIndex = 0;for (int i=0; i<commits.size(); i++) {@@ -434,7 +469,7 @@ public class RepoCommitsPage extends RepositoryPage {* @author robin**/- private static class LastAndCurrentCommits {+ private static class Commits {List<Commit> last;List<Commit> current;diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commits.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commits.cssindex 22bde5f44d..8f6a3a1f68 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commits.css+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commits.css@@ -12,6 +12,12 @@width: 37px;height: 37px;}+#repo-commits>.body .labels {+ margin-left: 8px;+}+#repo-commits>.body .label {+ margin-left: 4px;+}#repo-commits>.body .info {text-align: right;white-space: nowrap;