// skip index lines\r
} else if (line.startsWith("new file")) {\r
// skip new file lines\r
+ } else if (line.startsWith("\\ No newline")) {\r
+ // skip no new line\r
+ } else if (line.startsWith("---") || line.startsWith("+++")) {\r
+ // skip --- +++ lines\r
} else if (line.startsWith("diff")) {\r
if (line.indexOf(oldnull) > -1) {\r
// a is null, use b\r
sb.append("<div class=\"diff\">"); \r
sb.append("<table><tbody>");\r
inFile = true;\r
- } else if (line.startsWith("---") || line.startsWith("+++")) {\r
- // skip --- +++ lines\r
} else {\r
sb.append(line).append('\n');\r
}\r
import java.util.List;\r
import java.util.Map;\r
import java.util.Set;\r
+import java.util.concurrent.atomic.AtomicInteger;\r
\r
import org.eclipse.jgit.diff.DiffEntry;\r
import org.eclipse.jgit.diff.DiffFormatter;\r
return list;\r
}\r
\r
+ public static Map<ChangeType, AtomicInteger> getChangedPathsStats(List<PathChangeModel> paths) {\r
+ Map<ChangeType, AtomicInteger> stats = new HashMap<ChangeType, AtomicInteger>();\r
+ for (PathChangeModel path : paths) {\r
+ if (!stats.containsKey(path.changeType)) {\r
+ stats.put(path.changeType, new AtomicInteger(0));\r
+ }\r
+ stats.get(path.changeType).incrementAndGet();\r
+ }\r
+ return stats;\r
+ }\r
+\r
public static enum DiffOutputType {\r
PLAIN, GITWEB, GITBLIT;\r
\r
gb.deletion = deletion\r
gb.rename = rename\r
gb.stats = stats\r
-gb.markdown = markdown
\ No newline at end of file
+gb.markdown = markdown\r
+gb.changedFiles = changed files \r
+gb.filesAdded = {0} files added\r
+gb.filesModified = {0} files modified\r
+gb.filesDeleted = {0} files deleted\r
+gb.filesCopied = {0} files copied\r
+gb.filesRenamed = {0} files renamed
\ No newline at end of file
<div class="page_nav2">\r
<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>\r
</div> \r
+\r
+ <!-- commit legend -->\r
+ <div style="text-align:right;" wicket:id="commitLegend"></div>\r
\r
<!-- shortlog header -->\r
<div class="header" wicket:id="shortlog">[shortlog header]</div>\r
\r
<!-- changed paths -->\r
- <table style="margin-top:10px;border-top:1px solid #bbb;" class="pretty">\r
+ <table class="pretty">\r
<tr wicket:id="changedPath">\r
- <td><span wicket:id="changeType">[change type]</span></td> \r
+ <td class="changeType"><span wicket:id="changeType">[change type]</span></td> \r
<td class="path"><span wicket:id="pathName">[commit path]</span></td> \r
- <td>\r
+ <td class="rightAlign">\r
<span class="link">\r
<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>\r
</span>\r
import com.gitblit.wicket.RepositoryPage;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.models.PathModel.PathChangeModel;\r
+import com.gitblit.wicket.panels.CommitLegendPanel;\r
\r
public class CommitDiffPage extends RepositoryPage {\r
\r
\r
// changed paths list\r
List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, commit);\r
+ add(new CommitLegendPanel("commitLegend", paths));\r
ListDataProvider<PathChangeModel> pathsDp = new ListDataProvider<PathChangeModel>(paths);\r
DataView<PathChangeModel> pathsView = new DataView<PathChangeModel>("changedPath", pathsDp) {\r
private static final long serialVersionUID = 1L;\r
\r
<!-- full message -->\r
<div class="commit_message" wicket:id="fullMessage">[commit message]</div>\r
+\r
+ <!-- commit legend -->\r
+ <div style="text-align:right;" wicket:id="commitLegend"></div>\r
+ \r
+ <!-- header -->\r
+ <div class="header"><wicket:message key="gb.changedFiles">[changed files]</wicket:message></div>\r
\r
<!-- changed paths -->\r
- <table style="border-top:1px solid #bbb;" class="pretty">\r
+ <table class="pretty">\r
<tr wicket:id="changedPath">\r
- <td><span wicket:id="changeType">[change type]</span></td>\r
+ <td class="changeType"><span wicket:id="changeType">[change type]</span></td>\r
<td class="path"><span wicket:id="pathName">[commit path]</span></td> \r
- <td>\r
+ <td class="rightAlign">\r
<span class="link">\r
<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>\r
</span>\r
import com.gitblit.wicket.RepositoryPage;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.models.PathModel.PathChangeModel;\r
+import com.gitblit.wicket.panels.CommitLegendPanel;\r
\r
public class CommitPage extends RepositoryPage {\r
\r
add(WicketUtils.createTimestampLabel("commitAuthorDate", c.getAuthorIdent().getWhen(), getTimeZone()));\r
\r
// committer\r
- add(createPersonPanel("commitCommitter", c.getCommitterIdent(), SearchType.COMMITTER)); \r
+ add(createPersonPanel("commitCommitter", c.getCommitterIdent(), SearchType.COMMITTER));\r
add(WicketUtils.createTimestampLabel("commitCommitterDate", c.getCommitterIdent().getWhen(), getTimeZone()));\r
\r
add(new Label("commitId", c.getName()));\r
addFullText("fullMessage", c.getFullMessage(), true);\r
\r
// changed paths list\r
- List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, c);\r
+ List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, c); \r
+ add(new CommitLegendPanel("commitLegend", paths));\r
ListDataProvider<PathChangeModel> pathsDp = new ListDataProvider<PathChangeModel>(paths);\r
DataView<PathChangeModel> pathsView = new DataView<PathChangeModel>("changedPath", pathsDp) {\r
private static final long serialVersionUID = 1L;\r
};\r
add(pathsView);\r
}\r
- \r
+\r
@Override\r
protected String getPageName() {\r
return getString("gb.commit");\r
<div class="header"><wicket:message key="gb.ticketComments">comments</wicket:message></div>\r
\r
<!-- comments -->\r
- <table style="width:100%;" class="comments">\r
+ <table class="comments">\r
<tbody>\r
<tr valign="top" wicket:id="comment">\r
<td><span class="author" wicket:id="commentAuthor">[comment author]</span><br/>\r
<div style="margin-top:5px;" class="header" wicket:id="header">[header]</div>\r
\r
<!-- tickets --> \r
- <table style="width:100%" class="pretty">\r
+ <table class="pretty">\r
<tbody>\r
<tr wicket:id="ticket">\r
<td style="padding:0; margin:0;"><div wicket:id="ticketState">[ticket state]</div></td>\r
<!-- header -->\r
<div class="header" wicket:id="branches">[branches header]</div> \r
\r
- <table style="width:100%;" class="pretty">\r
+ <table class="pretty">\r
<tbody>\r
<tr wicket:id="branch">\r
<td class="date"><span wicket:id="branchDate">[branch date]</span></td>\r
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" \r
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
+ xml:lang="en" \r
+ lang="en"> \r
+\r
+<wicket:panel>\r
+ <div class="commitLegend" wicket:id="legend">\r
+ <span wicket:id="changeType">[change type]</span>\r
+ <span wicket:id="description">[description]</span>\r
+ </div> \r
+</wicket:panel>\r
+</html>
\ No newline at end of file
--- /dev/null
+package com.gitblit.wicket.panels;\r
+\r
+import java.text.MessageFormat;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+import java.util.Map;\r
+import java.util.concurrent.atomic.AtomicInteger;\r
+\r
+import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.panel.Panel;\r
+import org.apache.wicket.markup.repeater.Item;\r
+import org.apache.wicket.markup.repeater.data.DataView;\r
+import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
+import org.eclipse.jgit.diff.DiffEntry.ChangeType;\r
+\r
+import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.models.PathModel.PathChangeModel;\r
+\r
+public class CommitLegendPanel extends Panel {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public CommitLegendPanel(String id, List<PathChangeModel> paths) {\r
+ super(id);\r
+ final Map<ChangeType, AtomicInteger> stats = JGitUtils.getChangedPathsStats(paths); \r
+ ListDataProvider<ChangeType> legendDp = new ListDataProvider<ChangeType>(new ArrayList<ChangeType>(stats.keySet()));\r
+ DataView<ChangeType> legendsView = new DataView<ChangeType>("legend", legendDp) {\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public void populateItem(final Item<ChangeType> item) {\r
+ ChangeType entry = item.getModelObject();\r
+\r
+ Label changeType = new Label("changeType", "");\r
+ WicketUtils.setChangeTypeCssClass(changeType, entry);\r
+ item.add(changeType);\r
+ int count = stats.get(entry).intValue();\r
+ String description = "";\r
+ switch(entry) {\r
+ case ADD:\r
+ description = MessageFormat.format(getString("gb.filesAdded"), count);\r
+ break;\r
+ case MODIFY:\r
+ description = MessageFormat.format(getString("gb.filesModified"), count);\r
+ break;\r
+ case DELETE:\r
+ description = MessageFormat.format(getString("gb.filesDeleted"), count);\r
+ break;\r
+ case COPY:\r
+ description = MessageFormat.format(getString("gb.filesCopied"), count);\r
+ break;\r
+ case RENAME:\r
+ description = MessageFormat.format(getString("gb.filesRenamed"), count);\r
+ break;\r
+ } \r
+ item.add(new Label("description", description));\r
+ }\r
+ };\r
+ add(legendsView);\r
+ }\r
+}
\ No newline at end of file
<!-- breadcrumbs -->\r
<div wicket:id="breadcrumbs">[breadcrumbs]</div>\r
\r
- <table style="width:100%" class="pretty">\r
+ <table class="pretty">\r
<tbody>\r
<tr wicket:id="commit">\r
<td class="date"><span wicket:id="commitDate">[commit date]</span></td>\r
+ <td><img wicket:id="commitIcon" /></td>\r
<td class="author"><span wicket:id="commitAuthor">[commit author]</span></td>\r
- <td><span wicket:id="commitShortMessage">[commit short message]</span></td>\r
- <td class="rightAlign"><span wicket:id="commitRefs">[commit refs]</span></td> \r
+ <td><div class="references" wicket:id="commitRefs">[commit refs]</div><span wicket:id="commitShortMessage">[commit short message]</span></td>\r
<td class="rightAlign">\r
<span wicket:id="historyLinks">[history links]</span>\r
</td>\r
import java.util.Map;\r
\r
import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.image.ContextImage;\r
import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
import org.apache.wicket.markup.html.panel.Fragment;\r
import org.apache.wicket.markup.repeater.Item;\r
setPersonSearchTooltip(authorLink, author, SearchType.AUTHOR);\r
item.add(authorLink);\r
\r
+ // merge icon\r
+ if (entry.getParentCount() > 1) {\r
+ item.add(new ContextImage("commitIcon", "/com/gitblit/wicket/resources/commit_merge_16x16.png"));\r
+ } else {\r
+ item.add(new ContextImage("commitIcon", "/com/gitblit/wicket/resources/blank.png"));\r
+ }\r
+\r
String shortMessage = entry.getShortMessage();\r
String trimmedMessage = StringUtils.trimShortLog(shortMessage);\r
LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName()));\r
<!-- header --> \r
<div class="header" wicket:id="header">[log header]</div>\r
\r
- <table style="width:100%" class="pretty">\r
+ <table class="pretty">\r
<tbody>\r
<tr wicket:id="commit">\r
<td class="date"><span wicket:id="commitDate">[commit date]</span></td>\r
<td class="author"><span wicket:id="commitAuthor">[commit author]</span></td>\r
- <td><span wicket:id="commitShortMessage">[commit short message]</span></td>\r
- <td class="rightAlign"><span wicket:id="commitRefs">[commit refs]</span></td> \r
+ <td><img wicket:id="commitIcon" /></td>\r
+ <td><div class="references" wicket:id="commitRefs">[commit refs]</div><span wicket:id="commitShortMessage">[commit short message]</span></td>\r
<td class="rightAlign">\r
<span class="link">\r
<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>\r
import java.util.Map;\r
\r
import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.image.ContextImage;\r
import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
import org.apache.wicket.markup.repeater.Item;\r
import org.apache.wicket.markup.repeater.data.DataView;\r
setPersonSearchTooltip(authorLink, author, SearchType.AUTHOR);\r
item.add(authorLink);\r
\r
+ // merge icon\r
+ if (entry.getParentCount() > 1) {\r
+ item.add(new ContextImage("commitIcon", "/com/gitblit/wicket/resources/commit_merge_16x16.png"));\r
+ } else {\r
+ item.add(new ContextImage("commitIcon", "/com/gitblit/wicket/resources/blank.png"));\r
+ }\r
+ \r
+ // short message\r
String shortMessage = entry.getShortMessage();\r
String trimmedMessage = StringUtils.trimShortLog(shortMessage);\r
LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName()));\r
<!-- header --> \r
<div class="header" wicket:id="header">[search header]</div>\r
\r
- <table style="width:100%" class="pretty">\r
+ <table class="pretty">\r
<tbody>\r
<tr wicket:id="commit">\r
<td class="date"><span wicket:id="commitDate">[commit date]</span></td>\r
<td class="author"><span wicket:id="commitAuthor">[commit author]</span></td>\r
- <td><span wicket:id="commitShortMessage">[commit short message]</span></td>\r
- <td class="rightAlign"><span wicket:id="commitRefs">[commit refs]</span></td> \r
+ <td><img wicket:id="commitIcon" /></td>\r
+ <td><div class="references" wicket:id="commitRefs">[commit refs]</div><span wicket:id="commitShortMessage">[commit short message]</span></td>\r
<td class="rightAlign">\r
<span class="link">\r
<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>\r
import java.util.List;\r
import java.util.Map;\r
\r
+import org.apache.wicket.markup.html.image.ContextImage;\r
import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
import org.apache.wicket.markup.repeater.Item;\r
import org.apache.wicket.markup.repeater.data.DataView;\r
setPersonSearchTooltip(authorLink, author, SearchType.AUTHOR);\r
item.add(authorLink);\r
\r
+ // merge icon\r
+ if (entry.getParentCount() > 1) {\r
+ item.add(new ContextImage("commitIcon", "/com/gitblit/wicket/resources/commit_merge_16x16.png"));\r
+ } else {\r
+ item.add(new ContextImage("commitIcon", "/com/gitblit/wicket/resources/blank.png"));\r
+ }\r
+\r
String shortMessage = entry.getShortMessage();\r
String trimmedMessage = StringUtils.trimShortLog(shortMessage);\r
// TODO highlight matches\r
\r
<!-- tags -->\r
<div class="header" wicket:id="header">[tags header]</div> \r
- <table style="width:100%" class="pretty">\r
+ <table class="pretty">\r
<tbody>\r
<tr wicket:id="tag">\r
<td class="date"><span wicket:id="tagDate">[tag date]</span></td>\r
margin-left: auto;\r
margin-top: none;\r
padding: 0px;\r
+ background: url(background.png) repeat-x scroll 0 0 #FFFFFF;\r
}\r
\r
pre, code, pre.prettyprint, pre.plainprint {\r
font-weight: bold;\r
font-size: 150%;\r
color: #888;\r
- background-color: #ffffff;\r
+ background: transparent;\r
}\r
\r
div.page_header span { \r
color: #999;\r
padding-left: 5px;\r
padding-right: 5px;\r
+ width: 30px;\r
}\r
\r
div.diff table th.header {\r
background-color: #fbfbfb;\r
}\r
\r
+td.changeType {\r
+ width: 15px;\r
+}\r
+\r
span.addition, span.modification, span.deletion, span.rename {\r
border: 1px solid #888;\r
float: left;\r
background-color: #8888ff;\r
}\r
\r
+div.commitLegend {\r
+ float: right;\r
+ padding: 0.4em;\r
+ vertical-align:top;\r
+}\r
+\r
+div.commitLegend span {\r
+ font-size: 0.9em;\r
+ vertical-align: top;\r
+}\r
+\r
+div.references {\r
+ float: right;\r
+ text-align: right;\r
+}\r
+\r
a.list {\r
text-decoration: none;\r
color: #000000;\r
border-right: 1px solid #bbb; \r
}\r
\r
+table.pretty, table.comments, table.repositories {\r
+ width:100%;\r
+}\r
table.pretty td {\r
padding: 2px 4px;\r
}\r
line-height: 17px;\r
}\r
\r
-table.repositories {\r
- width:100%; \r
-}\r
-\r
table.repositories th {\r
background-color:#D2C3AF;\r
padding: 4px;\r
}\r
\r
span .tagRef, span .headRef, span .remoteRef, span .otherRef { \r
- padding: 0px 4px;\r
+ padding: 0px 3px;\r
margin-right:2px;\r
font-family: sans-serif;\r
font-size: 9px;\r
font-weight: normal;\r
border: 1px solid;\r
- color: black;\r
+ color: black; \r
}\r
\r
span .tagRef a span, span .headRef a span, span .remoteRef a span, span .otherRef a span {\r
\r
span .tagRef a, span .headRef a, span .remoteRef a, span .otherRef a {\r
text-decoration: none;\r
- color: black;\r
+ color: black !important;\r
}\r
\r
span .tagRef a:hover, span .headRef a:hover, span .remoteRef a:hover, span .otherRef a:hover {\r
- color: black;\r
+ color: black !important;\r
text-decoration: underline;\r
}\r
\r