Browse Source

Added merge icon. Added commit legend with counts. Improved header.

tags/v0.5.0
James Moger 13 years ago
parent
commit
a645ba09d6
26 changed files with 187 additions and 34 deletions
  1. 4
    2
      src/com/gitblit/utils/GitBlitDiffFormatter.java
  2. 12
    0
      src/com/gitblit/utils/JGitUtils.java
  3. 7
    1
      src/com/gitblit/wicket/GitBlitWebApp.properties
  4. 6
    3
      src/com/gitblit/wicket/pages/CommitDiffPage.html
  5. 2
    0
      src/com/gitblit/wicket/pages/CommitDiffPage.java
  6. 9
    3
      src/com/gitblit/wicket/pages/CommitPage.html
  7. 5
    3
      src/com/gitblit/wicket/pages/CommitPage.java
  8. 1
    1
      src/com/gitblit/wicket/pages/TicketPage.html
  9. 1
    1
      src/com/gitblit/wicket/pages/TicketsPage.html
  10. 1
    1
      src/com/gitblit/wicket/panels/BranchesPanel.html
  11. 13
    0
      src/com/gitblit/wicket/panels/CommitLegendPanel.html
  12. 61
    0
      src/com/gitblit/wicket/panels/CommitLegendPanel.java
  13. 3
    3
      src/com/gitblit/wicket/panels/HistoryPanel.html
  14. 8
    0
      src/com/gitblit/wicket/panels/HistoryPanel.java
  15. 3
    3
      src/com/gitblit/wicket/panels/LogPanel.html
  16. 9
    0
      src/com/gitblit/wicket/panels/LogPanel.java
  17. 3
    3
      src/com/gitblit/wicket/panels/SearchPanel.html
  18. 8
    0
      src/com/gitblit/wicket/panels/SearchPanel.java
  19. 1
    1
      src/com/gitblit/wicket/panels/TagsPanel.html
  20. BIN
      src/com/gitblit/wicket/resources/background.png
  21. BIN
      src/com/gitblit/wicket/resources/commit_branch_16x16.png
  22. BIN
      src/com/gitblit/wicket/resources/commit_divide_16x16.png
  23. BIN
      src/com/gitblit/wicket/resources/commit_join_16x16.png
  24. BIN
      src/com/gitblit/wicket/resources/commit_merge_16x16.png
  25. BIN
      src/com/gitblit/wicket/resources/commit_up_16x16.png
  26. 30
    9
      src/com/gitblit/wicket/resources/gitblit.css

+ 4
- 2
src/com/gitblit/utils/GitBlitDiffFormatter.java View File

@@ -97,6 +97,10 @@ public class GitBlitDiffFormatter extends GitWebDiffFormatter {
// skip index lines
} else if (line.startsWith("new file")) {
// skip new file lines
} else if (line.startsWith("\\ No newline")) {
// skip no new line
} else if (line.startsWith("---") || line.startsWith("+++")) {
// skip --- +++ lines
} else if (line.startsWith("diff")) {
if (line.indexOf(oldnull) > -1) {
// a is null, use b
@@ -115,8 +119,6 @@ public class GitBlitDiffFormatter extends GitWebDiffFormatter {
sb.append("<div class=\"diff\">");
sb.append("<table><tbody>");
inFile = true;
} else if (line.startsWith("---") || line.startsWith("+++")) {
// skip --- +++ lines
} else {
sb.append(line).append('\n');
}

+ 12
- 0
src/com/gitblit/utils/JGitUtils.java View File

@@ -15,6 +15,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.diff.DiffFormatter;
@@ -326,6 +327,17 @@ public class JGitUtils {
return list;
}
public static Map<ChangeType, AtomicInteger> getChangedPathsStats(List<PathChangeModel> paths) {
Map<ChangeType, AtomicInteger> stats = new HashMap<ChangeType, AtomicInteger>();
for (PathChangeModel path : paths) {
if (!stats.containsKey(path.changeType)) {
stats.put(path.changeType, new AtomicInteger(0));
}
stats.get(path.changeType).incrementAndGet();
}
return stats;
}
public static enum DiffOutputType {
PLAIN, GITWEB, GITBLIT;

+ 7
- 1
src/com/gitblit/wicket/GitBlitWebApp.properties View File

@@ -56,4 +56,10 @@ gb.modification = modification
gb.deletion = deletion
gb.rename = rename
gb.stats = stats
gb.markdown = markdown
gb.markdown = markdown
gb.changedFiles = changed files
gb.filesAdded = {0} files added
gb.filesModified = {0} files modified
gb.filesDeleted = {0} files deleted
gb.filesCopied = {0} files copied
gb.filesRenamed = {0} files renamed

+ 6
- 3
src/com/gitblit/wicket/pages/CommitDiffPage.html View File

@@ -14,16 +14,19 @@
<div class="page_nav2">
<wicket:message key="gb.parent"></wicket:message>: <span wicket:id="parentLink">[parent link]</span> | <a wicket:id="patchLink"><wicket:message key="gb.patch"></wicket:message></a> | <a wicket:id="commitLink"><wicket:message key="gb.commit"></wicket:message></a>
</div>
<!-- commit legend -->
<div style="text-align:right;" wicket:id="commitLegend"></div>
<!-- shortlog header -->
<div class="header" wicket:id="shortlog">[shortlog header]</div>
<!-- changed paths -->
<table style="margin-top:10px;border-top:1px solid #bbb;" class="pretty">
<table class="pretty">
<tr wicket:id="changedPath">
<td><span wicket:id="changeType">[change type]</span></td>
<td class="changeType"><span wicket:id="changeType">[change type]</span></td>
<td class="path"><span wicket:id="pathName">[commit path]</span></td>
<td>
<td class="rightAlign">
<span class="link">
<a wicket:id="patch"><wicket:message key="gb.patch"></wicket:message></a> | <a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="blame"><wicket:message key="gb.blame"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a>
</span>

+ 2
- 0
src/com/gitblit/wicket/pages/CommitDiffPage.java View File

@@ -20,6 +20,7 @@ import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.models.PathModel.PathChangeModel;
import com.gitblit.wicket.panels.CommitLegendPanel;
public class CommitDiffPage extends RepositoryPage {
@@ -51,6 +52,7 @@ public class CommitDiffPage extends RepositoryPage {
// changed paths list
List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, commit);
add(new CommitLegendPanel("commitLegend", paths));
ListDataProvider<PathChangeModel> pathsDp = new ListDataProvider<PathChangeModel>(paths);
DataView<PathChangeModel> pathsView = new DataView<PathChangeModel>("changedPath", pathsDp) {
private static final long serialVersionUID = 1L;

+ 9
- 3
src/com/gitblit/wicket/pages/CommitPage.html View File

@@ -41,13 +41,19 @@
<!-- full message -->
<div class="commit_message" wicket:id="fullMessage">[commit message]</div>
<!-- commit legend -->
<div style="text-align:right;" wicket:id="commitLegend"></div>
<!-- header -->
<div class="header"><wicket:message key="gb.changedFiles">[changed files]</wicket:message></div>
<!-- changed paths -->
<table style="border-top:1px solid #bbb;" class="pretty">
<table class="pretty">
<tr wicket:id="changedPath">
<td><span wicket:id="changeType">[change type]</span></td>
<td class="changeType"><span wicket:id="changeType">[change type]</span></td>
<td class="path"><span wicket:id="pathName">[commit path]</span></td>
<td>
<td class="rightAlign">
<span class="link">
<a wicket:id="diff"><wicket:message key="gb.diff"></wicket:message></a> | <a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="blame"><wicket:message key="gb.blame"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a>
</span>

+ 5
- 3
src/com/gitblit/wicket/pages/CommitPage.java View File

@@ -19,6 +19,7 @@ import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.models.PathModel.PathChangeModel;
import com.gitblit.wicket.panels.CommitLegendPanel;
public class CommitPage extends RepositoryPage {
@@ -54,7 +55,7 @@ public class CommitPage extends RepositoryPage {
add(WicketUtils.createTimestampLabel("commitAuthorDate", c.getAuthorIdent().getWhen(), getTimeZone()));
// committer
add(createPersonPanel("commitCommitter", c.getCommitterIdent(), SearchType.COMMITTER));
add(createPersonPanel("commitCommitter", c.getCommitterIdent(), SearchType.COMMITTER));
add(WicketUtils.createTimestampLabel("commitCommitterDate", c.getCommitterIdent().getWhen(), getTimeZone()));
add(new Label("commitId", c.getName()));
@@ -78,7 +79,8 @@ public class CommitPage extends RepositoryPage {
addFullText("fullMessage", c.getFullMessage(), true);
// changed paths list
List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, c);
List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, c);
add(new CommitLegendPanel("commitLegend", paths));
ListDataProvider<PathChangeModel> pathsDp = new ListDataProvider<PathChangeModel>(paths);
DataView<PathChangeModel> pathsView = new DataView<PathChangeModel>("changedPath", pathsDp) {
private static final long serialVersionUID = 1L;
@@ -107,7 +109,7 @@ public class CommitPage extends RepositoryPage {
};
add(pathsView);
}
@Override
protected String getPageName() {
return getString("gb.commit");

+ 1
- 1
src/com/gitblit/wicket/pages/TicketPage.html View File

@@ -26,7 +26,7 @@
<div class="header"><wicket:message key="gb.ticketComments">comments</wicket:message></div>
<!-- comments -->
<table style="width:100%;" class="comments">
<table class="comments">
<tbody>
<tr valign="top" wicket:id="comment">
<td><span class="author" wicket:id="commentAuthor">[comment author]</span><br/>

+ 1
- 1
src/com/gitblit/wicket/pages/TicketsPage.html View File

@@ -14,7 +14,7 @@
<div style="margin-top:5px;" class="header" wicket:id="header">[header]</div>
<!-- tickets -->
<table style="width:100%" class="pretty">
<table class="pretty">
<tbody>
<tr wicket:id="ticket">
<td style="padding:0; margin:0;"><div wicket:id="ticketState">[ticket state]</div></td>

+ 1
- 1
src/com/gitblit/wicket/panels/BranchesPanel.html View File

@@ -10,7 +10,7 @@
<!-- header -->
<div class="header" wicket:id="branches">[branches header]</div>
<table style="width:100%;" class="pretty">
<table class="pretty">
<tbody>
<tr wicket:id="branch">
<td class="date"><span wicket:id="branchDate">[branch date]</span></td>

+ 13
- 0
src/com/gitblit/wicket/panels/CommitLegendPanel.html View File

@@ -0,0 +1,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
xml:lang="en"
lang="en">
<wicket:panel>
<div class="commitLegend" wicket:id="legend">
<span wicket:id="changeType">[change type]</span>
<span wicket:id="description">[description]</span>
</div>
</wicket:panel>
</html>

+ 61
- 0
src/com/gitblit/wicket/panels/CommitLegendPanel.java View File

@@ -0,0 +1,61 @@
package com.gitblit.wicket.panels;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.markup.repeater.data.ListDataProvider;
import org.eclipse.jgit.diff.DiffEntry.ChangeType;
import com.gitblit.utils.JGitUtils;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.models.PathModel.PathChangeModel;
public class CommitLegendPanel extends Panel {
private static final long serialVersionUID = 1L;
public CommitLegendPanel(String id, List<PathChangeModel> paths) {
super(id);
final Map<ChangeType, AtomicInteger> stats = JGitUtils.getChangedPathsStats(paths);
ListDataProvider<ChangeType> legendDp = new ListDataProvider<ChangeType>(new ArrayList<ChangeType>(stats.keySet()));
DataView<ChangeType> legendsView = new DataView<ChangeType>("legend", legendDp) {
private static final long serialVersionUID = 1L;
public void populateItem(final Item<ChangeType> item) {
ChangeType entry = item.getModelObject();
Label changeType = new Label("changeType", "");
WicketUtils.setChangeTypeCssClass(changeType, entry);
item.add(changeType);
int count = stats.get(entry).intValue();
String description = "";
switch(entry) {
case ADD:
description = MessageFormat.format(getString("gb.filesAdded"), count);
break;
case MODIFY:
description = MessageFormat.format(getString("gb.filesModified"), count);
break;
case DELETE:
description = MessageFormat.format(getString("gb.filesDeleted"), count);
break;
case COPY:
description = MessageFormat.format(getString("gb.filesCopied"), count);
break;
case RENAME:
description = MessageFormat.format(getString("gb.filesRenamed"), count);
break;
}
item.add(new Label("description", description));
}
};
add(legendsView);
}
}

+ 3
- 3
src/com/gitblit/wicket/panels/HistoryPanel.html View File

@@ -13,13 +13,13 @@
<!-- breadcrumbs -->
<div wicket:id="breadcrumbs">[breadcrumbs]</div>
<table style="width:100%" class="pretty">
<table class="pretty">
<tbody>
<tr wicket:id="commit">
<td class="date"><span wicket:id="commitDate">[commit date]</span></td>
<td><img wicket:id="commitIcon" /></td>
<td class="author"><span wicket:id="commitAuthor">[commit author]</span></td>
<td><span wicket:id="commitShortMessage">[commit short message]</span></td>
<td class="rightAlign"><span wicket:id="commitRefs">[commit refs]</span></td>
<td><div class="references" wicket:id="commitRefs">[commit refs]</div><span wicket:id="commitShortMessage">[commit short message]</span></td>
<td class="rightAlign">
<span wicket:id="historyLinks">[history links]</span>
</td>

+ 8
- 0
src/com/gitblit/wicket/panels/HistoryPanel.java View File

@@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.image.ContextImage;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.markup.repeater.Item;
@@ -104,6 +105,13 @@ public class HistoryPanel extends BasePanel {
setPersonSearchTooltip(authorLink, author, SearchType.AUTHOR);
item.add(authorLink);
// merge icon
if (entry.getParentCount() > 1) {
item.add(new ContextImage("commitIcon", "/com/gitblit/wicket/resources/commit_merge_16x16.png"));
} else {
item.add(new ContextImage("commitIcon", "/com/gitblit/wicket/resources/blank.png"));
}
String shortMessage = entry.getShortMessage();
String trimmedMessage = StringUtils.trimShortLog(shortMessage);
LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName()));

+ 3
- 3
src/com/gitblit/wicket/panels/LogPanel.html View File

@@ -10,13 +10,13 @@
<!-- header -->
<div class="header" wicket:id="header">[log header]</div>
<table style="width:100%" class="pretty">
<table class="pretty">
<tbody>
<tr wicket:id="commit">
<td class="date"><span wicket:id="commitDate">[commit date]</span></td>
<td class="author"><span wicket:id="commitAuthor">[commit author]</span></td>
<td><span wicket:id="commitShortMessage">[commit short message]</span></td>
<td class="rightAlign"><span wicket:id="commitRefs">[commit refs]</span></td>
<td><img wicket:id="commitIcon" /></td>
<td><div class="references" wicket:id="commitRefs">[commit refs]</div><span wicket:id="commitShortMessage">[commit short message]</span></td>
<td class="rightAlign">
<span class="link">
<a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="diff"><wicket:message key="gb.diff"></wicket:message></a> | <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a>

+ 9
- 0
src/com/gitblit/wicket/panels/LogPanel.java View File

@@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.image.ContextImage;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
@@ -84,6 +85,14 @@ public class LogPanel extends BasePanel {
setPersonSearchTooltip(authorLink, author, SearchType.AUTHOR);
item.add(authorLink);
// merge icon
if (entry.getParentCount() > 1) {
item.add(new ContextImage("commitIcon", "/com/gitblit/wicket/resources/commit_merge_16x16.png"));
} else {
item.add(new ContextImage("commitIcon", "/com/gitblit/wicket/resources/blank.png"));
}
// short message
String shortMessage = entry.getShortMessage();
String trimmedMessage = StringUtils.trimShortLog(shortMessage);
LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName()));

+ 3
- 3
src/com/gitblit/wicket/panels/SearchPanel.html View File

@@ -10,13 +10,13 @@
<!-- header -->
<div class="header" wicket:id="header">[search header]</div>
<table style="width:100%" class="pretty">
<table class="pretty">
<tbody>
<tr wicket:id="commit">
<td class="date"><span wicket:id="commitDate">[commit date]</span></td>
<td class="author"><span wicket:id="commitAuthor">[commit author]</span></td>
<td><span wicket:id="commitShortMessage">[commit short message]</span></td>
<td class="rightAlign"><span wicket:id="commitRefs">[commit refs]</span></td>
<td><img wicket:id="commitIcon" /></td>
<td><div class="references" wicket:id="commitRefs">[commit refs]</div><span wicket:id="commitShortMessage">[commit short message]</span></td>
<td class="rightAlign">
<span class="link">
<a wicket:id="commit"><wicket:message key="gb.commit"></wicket:message></a> | <a wicket:id="commitdiff"><wicket:message key="gb.commitdiff"></wicket:message></a> | <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a>

+ 8
- 0
src/com/gitblit/wicket/panels/SearchPanel.java View File

@@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.wicket.markup.html.image.ContextImage;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
@@ -74,6 +75,13 @@ public class SearchPanel extends BasePanel {
setPersonSearchTooltip(authorLink, author, SearchType.AUTHOR);
item.add(authorLink);
// merge icon
if (entry.getParentCount() > 1) {
item.add(new ContextImage("commitIcon", "/com/gitblit/wicket/resources/commit_merge_16x16.png"));
} else {
item.add(new ContextImage("commitIcon", "/com/gitblit/wicket/resources/blank.png"));
}
String shortMessage = entry.getShortMessage();
String trimmedMessage = StringUtils.trimShortLog(shortMessage);
// TODO highlight matches

+ 1
- 1
src/com/gitblit/wicket/panels/TagsPanel.html View File

@@ -9,7 +9,7 @@
<!-- tags -->
<div class="header" wicket:id="header">[tags header]</div>
<table style="width:100%" class="pretty">
<table class="pretty">
<tbody>
<tr wicket:id="tag">
<td class="date"><span wicket:id="tagDate">[tag date]</span></td>

BIN
src/com/gitblit/wicket/resources/background.png View File


BIN
src/com/gitblit/wicket/resources/commit_branch_16x16.png View File


BIN
src/com/gitblit/wicket/resources/commit_divide_16x16.png View File


BIN
src/com/gitblit/wicket/resources/commit_join_16x16.png View File


BIN
src/com/gitblit/wicket/resources/commit_merge_16x16.png View File


BIN
src/com/gitblit/wicket/resources/commit_up_16x16.png View File


+ 30
- 9
src/com/gitblit/wicket/resources/gitblit.css View File

@@ -20,6 +20,7 @@ body {
margin-left: auto;
margin-top: none;
padding: 0px;
background: url(background.png) repeat-x scroll 0 0 #FFFFFF;
}
pre, code, pre.prettyprint, pre.plainprint {
@@ -110,7 +111,7 @@ div.page_header {
font-weight: bold;
font-size: 150%;
color: #888;
background-color: #ffffff;
background: transparent;
}
div.page_header span {
@@ -313,6 +314,7 @@ div.diff table th {
color: #999;
padding-left: 5px;
padding-right: 5px;
width: 30px;
}
div.diff table th.header {
@@ -337,6 +339,10 @@ div.diff table td {
background-color: #fbfbfb;
}
td.changeType {
width: 15px;
}
span.addition, span.modification, span.deletion, span.rename {
border: 1px solid #888;
float: left;
@@ -362,6 +368,22 @@ span.rename {
background-color: #8888ff;
}
div.commitLegend {
float: right;
padding: 0.4em;
vertical-align:top;
}
div.commitLegend span {
font-size: 0.9em;
vertical-align: top;
}
div.references {
float: right;
text-align: right;
}
a.list {
text-decoration: none;
color: #000000;
@@ -401,6 +423,9 @@ table.pretty, table.repositories, table.comments {
border-right: 1px solid #bbb;
}
table.pretty, table.comments, table.repositories {
width:100%;
}
table.pretty td {
padding: 2px 4px;
}
@@ -410,10 +435,6 @@ table.comments td {
line-height: 17px;
}
table.repositories {
width:100%;
}
table.repositories th {
background-color:#D2C3AF;
padding: 4px;
@@ -509,13 +530,13 @@ td.rightAlign {
}
span .tagRef, span .headRef, span .remoteRef, span .otherRef {
padding: 0px 4px;
padding: 0px 3px;
margin-right:2px;
font-family: sans-serif;
font-size: 9px;
font-weight: normal;
border: 1px solid;
color: black;
color: black;
}
span .tagRef a span, span .headRef a span, span .remoteRef a span, span .otherRef a span {
@@ -524,11 +545,11 @@ span .tagRef a span, span .headRef a span, span .remoteRef a span, span .otherRe
span .tagRef a, span .headRef a, span .remoteRef a, span .otherRef a {
text-decoration: none;
color: black;
color: black !important;
}
span .tagRef a:hover, span .headRef a:hover, span .remoteRef a:hover, span .otherRef a:hover {
color: black;
color: black !important;
text-decoration: underline;
}

Loading…
Cancel
Save