From a645ba09d693495c50ab0ee0d1fc2734407b73a4 Mon Sep 17 00:00:00 2001 From: James Moger Date: Thu, 21 Apr 2011 20:50:59 -0400 Subject: Added merge icon. Added commit legend with counts. Improved header. --- src/com/gitblit/utils/GitBlitDiffFormatter.java | 6 +- src/com/gitblit/utils/JGitUtils.java | 12 ++++ src/com/gitblit/wicket/GitBlitWebApp.properties | 8 ++- src/com/gitblit/wicket/pages/CommitDiffPage.html | 9 ++- src/com/gitblit/wicket/pages/CommitDiffPage.java | 2 + src/com/gitblit/wicket/pages/CommitPage.html | 12 +++- src/com/gitblit/wicket/pages/CommitPage.java | 8 ++- src/com/gitblit/wicket/pages/TicketPage.html | 2 +- src/com/gitblit/wicket/pages/TicketsPage.html | 2 +- src/com/gitblit/wicket/panels/BranchesPanel.html | 2 +- .../gitblit/wicket/panels/CommitLegendPanel.html | 13 +++++ .../gitblit/wicket/panels/CommitLegendPanel.java | 61 +++++++++++++++++++++ src/com/gitblit/wicket/panels/HistoryPanel.html | 6 +- src/com/gitblit/wicket/panels/HistoryPanel.java | 8 +++ src/com/gitblit/wicket/panels/LogPanel.html | 6 +- src/com/gitblit/wicket/panels/LogPanel.java | 9 +++ src/com/gitblit/wicket/panels/SearchPanel.html | 6 +- src/com/gitblit/wicket/panels/SearchPanel.java | 8 +++ src/com/gitblit/wicket/panels/TagsPanel.html | 2 +- src/com/gitblit/wicket/resources/background.png | Bin 0 -> 561 bytes .../wicket/resources/commit_branch_16x16.png | Bin 0 -> 655 bytes .../wicket/resources/commit_divide_16x16.png | Bin 0 -> 651 bytes .../gitblit/wicket/resources/commit_join_16x16.png | Bin 0 -> 556 bytes .../wicket/resources/commit_merge_16x16.png | Bin 0 -> 508 bytes .../gitblit/wicket/resources/commit_up_16x16.png | Bin 0 -> 391 bytes src/com/gitblit/wicket/resources/gitblit.css | 39 ++++++++++--- 26 files changed, 187 insertions(+), 34 deletions(-) create mode 100644 src/com/gitblit/wicket/panels/CommitLegendPanel.html create mode 100644 src/com/gitblit/wicket/panels/CommitLegendPanel.java create mode 100644 src/com/gitblit/wicket/resources/background.png create mode 100644 src/com/gitblit/wicket/resources/commit_branch_16x16.png create mode 100644 src/com/gitblit/wicket/resources/commit_divide_16x16.png create mode 100644 src/com/gitblit/wicket/resources/commit_join_16x16.png create mode 100644 src/com/gitblit/wicket/resources/commit_merge_16x16.png create mode 100644 src/com/gitblit/wicket/resources/commit_up_16x16.png (limited to 'src') diff --git a/src/com/gitblit/utils/GitBlitDiffFormatter.java b/src/com/gitblit/utils/GitBlitDiffFormatter.java index 54cb6c29..b8dceb47 100644 --- a/src/com/gitblit/utils/GitBlitDiffFormatter.java +++ b/src/com/gitblit/utils/GitBlitDiffFormatter.java @@ -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("
"); sb.append(""); inFile = true; - } else if (line.startsWith("---") || line.startsWith("+++")) { - // skip --- +++ lines } else { sb.append(line).append('\n'); } diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java index 5118425e..cd3e6efe 100644 --- a/src/com/gitblit/utils/JGitUtils.java +++ b/src/com/gitblit/utils/JGitUtils.java @@ -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 getChangedPathsStats(List paths) { + Map stats = new HashMap(); + 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; diff --git a/src/com/gitblit/wicket/GitBlitWebApp.properties b/src/com/gitblit/wicket/GitBlitWebApp.properties index a2e51d11..cb8953ae 100644 --- a/src/com/gitblit/wicket/GitBlitWebApp.properties +++ b/src/com/gitblit/wicket/GitBlitWebApp.properties @@ -56,4 +56,10 @@ gb.modification = modification gb.deletion = deletion gb.rename = rename gb.stats = stats -gb.markdown = markdown \ No newline at end of file +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 \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/CommitDiffPage.html b/src/com/gitblit/wicket/pages/CommitDiffPage.html index a3a480b5..cc7404ad 100644 --- a/src/com/gitblit/wicket/pages/CommitDiffPage.html +++ b/src/com/gitblit/wicket/pages/CommitDiffPage.html @@ -14,16 +14,19 @@ + + +
[shortlog header]
-
+
- + -
[change type][change type] [commit path] + | | | diff --git a/src/com/gitblit/wicket/pages/CommitDiffPage.java b/src/com/gitblit/wicket/pages/CommitDiffPage.java index c6f1f7d3..0d4867ab 100644 --- a/src/com/gitblit/wicket/pages/CommitDiffPage.java +++ b/src/com/gitblit/wicket/pages/CommitDiffPage.java @@ -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 paths = JGitUtils.getFilesInCommit(r, commit); + add(new CommitLegendPanel("commitLegend", paths)); ListDataProvider pathsDp = new ListDataProvider(paths); DataView pathsView = new DataView("changedPath", pathsDp) { private static final long serialVersionUID = 1L; diff --git a/src/com/gitblit/wicket/pages/CommitPage.html b/src/com/gitblit/wicket/pages/CommitPage.html index 87547fca..2e1f47c4 100644 --- a/src/com/gitblit/wicket/pages/CommitPage.html +++ b/src/com/gitblit/wicket/pages/CommitPage.html @@ -41,13 +41,19 @@
[commit message]
+ + +
+ + +
[changed files]
- +
- + -
[change type][change type] [commit path] + | | | diff --git a/src/com/gitblit/wicket/pages/CommitPage.java b/src/com/gitblit/wicket/pages/CommitPage.java index 04065233..cae500f6 100644 --- a/src/com/gitblit/wicket/pages/CommitPage.java +++ b/src/com/gitblit/wicket/pages/CommitPage.java @@ -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 paths = JGitUtils.getFilesInCommit(r, c); + List paths = JGitUtils.getFilesInCommit(r, c); + add(new CommitLegendPanel("commitLegend", paths)); ListDataProvider pathsDp = new ListDataProvider(paths); DataView pathsView = new DataView("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"); diff --git a/src/com/gitblit/wicket/pages/TicketPage.html b/src/com/gitblit/wicket/pages/TicketPage.html index 56e29804..b61f7f95 100644 --- a/src/com/gitblit/wicket/pages/TicketPage.html +++ b/src/com/gitblit/wicket/pages/TicketPage.html @@ -26,7 +26,7 @@
comments
- +
[comment author]
diff --git a/src/com/gitblit/wicket/pages/TicketsPage.html b/src/com/gitblit/wicket/pages/TicketsPage.html index eb74b125..0c865f33 100644 --- a/src/com/gitblit/wicket/pages/TicketsPage.html +++ b/src/com/gitblit/wicket/pages/TicketsPage.html @@ -14,7 +14,7 @@
[header]
- +
diff --git a/src/com/gitblit/wicket/panels/BranchesPanel.html b/src/com/gitblit/wicket/panels/BranchesPanel.html index 76c3e09f..497003a5 100644 --- a/src/com/gitblit/wicket/panels/BranchesPanel.html +++ b/src/com/gitblit/wicket/panels/BranchesPanel.html @@ -10,7 +10,7 @@
[branches header]
-
[ticket state]
+
diff --git a/src/com/gitblit/wicket/panels/CommitLegendPanel.html b/src/com/gitblit/wicket/panels/CommitLegendPanel.html new file mode 100644 index 00000000..71063626 --- /dev/null +++ b/src/com/gitblit/wicket/panels/CommitLegendPanel.html @@ -0,0 +1,13 @@ + + + + +
+ [change type] + [description] +
+
+ \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/CommitLegendPanel.java b/src/com/gitblit/wicket/panels/CommitLegendPanel.java new file mode 100644 index 00000000..9833d643 --- /dev/null +++ b/src/com/gitblit/wicket/panels/CommitLegendPanel.java @@ -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 paths) { + super(id); + final Map stats = JGitUtils.getChangedPathsStats(paths); + ListDataProvider legendDp = new ListDataProvider(new ArrayList(stats.keySet())); + DataView legendsView = new DataView("legend", legendDp) { + private static final long serialVersionUID = 1L; + + public void populateItem(final Item 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); + } +} \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/HistoryPanel.html b/src/com/gitblit/wicket/panels/HistoryPanel.html index ad0ff2f8..1ed1b583 100644 --- a/src/com/gitblit/wicket/panels/HistoryPanel.html +++ b/src/com/gitblit/wicket/panels/HistoryPanel.html @@ -13,13 +13,13 @@
[breadcrumbs]
-
[branch date]
+
+ - - + diff --git a/src/com/gitblit/wicket/panels/HistoryPanel.java b/src/com/gitblit/wicket/panels/HistoryPanel.java index e68fc1ab..da269989 100644 --- a/src/com/gitblit/wicket/panels/HistoryPanel.java +++ b/src/com/gitblit/wicket/panels/HistoryPanel.java @@ -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())); diff --git a/src/com/gitblit/wicket/panels/LogPanel.html b/src/com/gitblit/wicket/panels/LogPanel.html index 838b28c4..1a6f6f43 100644 --- a/src/com/gitblit/wicket/panels/LogPanel.html +++ b/src/com/gitblit/wicket/panels/LogPanel.html @@ -10,13 +10,13 @@
[log header]
-
[commit date] [commit author][commit short message][commit refs]
[commit refs]
[commit short message]
[history links]
+
- - + +
[commit date] [commit author][commit short message][commit refs]
[commit refs]
[commit short message]
| | diff --git a/src/com/gitblit/wicket/panels/LogPanel.java b/src/com/gitblit/wicket/panels/LogPanel.java index 04575115..8895dbcb 100644 --- a/src/com/gitblit/wicket/panels/LogPanel.java +++ b/src/com/gitblit/wicket/panels/LogPanel.java @@ -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())); diff --git a/src/com/gitblit/wicket/panels/SearchPanel.html b/src/com/gitblit/wicket/panels/SearchPanel.html index a99fd7e4..f8994b9d 100644 --- a/src/com/gitblit/wicket/panels/SearchPanel.html +++ b/src/com/gitblit/wicket/panels/SearchPanel.html @@ -10,13 +10,13 @@
[search header]
- +
- - + +
[commit date] [commit author][commit short message][commit refs]
[commit refs]
[commit short message]
| | diff --git a/src/com/gitblit/wicket/panels/SearchPanel.java b/src/com/gitblit/wicket/panels/SearchPanel.java index 6f4858be..315d4760 100644 --- a/src/com/gitblit/wicket/panels/SearchPanel.java +++ b/src/com/gitblit/wicket/panels/SearchPanel.java @@ -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 diff --git a/src/com/gitblit/wicket/panels/TagsPanel.html b/src/com/gitblit/wicket/panels/TagsPanel.html index 278b7e9b..09019cf8 100644 --- a/src/com/gitblit/wicket/panels/TagsPanel.html +++ b/src/com/gitblit/wicket/panels/TagsPanel.html @@ -9,7 +9,7 @@
[tags header]
- +
diff --git a/src/com/gitblit/wicket/resources/background.png b/src/com/gitblit/wicket/resources/background.png new file mode 100644 index 00000000..6f75e43d Binary files /dev/null and b/src/com/gitblit/wicket/resources/background.png differ diff --git a/src/com/gitblit/wicket/resources/commit_branch_16x16.png b/src/com/gitblit/wicket/resources/commit_branch_16x16.png new file mode 100644 index 00000000..d1fe7175 Binary files /dev/null and b/src/com/gitblit/wicket/resources/commit_branch_16x16.png differ diff --git a/src/com/gitblit/wicket/resources/commit_divide_16x16.png b/src/com/gitblit/wicket/resources/commit_divide_16x16.png new file mode 100644 index 00000000..e611bd57 Binary files /dev/null and b/src/com/gitblit/wicket/resources/commit_divide_16x16.png differ diff --git a/src/com/gitblit/wicket/resources/commit_join_16x16.png b/src/com/gitblit/wicket/resources/commit_join_16x16.png new file mode 100644 index 00000000..51e7de97 Binary files /dev/null and b/src/com/gitblit/wicket/resources/commit_join_16x16.png differ diff --git a/src/com/gitblit/wicket/resources/commit_merge_16x16.png b/src/com/gitblit/wicket/resources/commit_merge_16x16.png new file mode 100644 index 00000000..5a066e59 Binary files /dev/null and b/src/com/gitblit/wicket/resources/commit_merge_16x16.png differ diff --git a/src/com/gitblit/wicket/resources/commit_up_16x16.png b/src/com/gitblit/wicket/resources/commit_up_16x16.png new file mode 100644 index 00000000..30d005f2 Binary files /dev/null and b/src/com/gitblit/wicket/resources/commit_up_16x16.png differ diff --git a/src/com/gitblit/wicket/resources/gitblit.css b/src/com/gitblit/wicket/resources/gitblit.css index eff6f2af..fa78cec8 100644 --- a/src/com/gitblit/wicket/resources/gitblit.css +++ b/src/com/gitblit/wicket/resources/gitblit.css @@ -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; } -- cgit v1.2.3
[tag date]