James Moger
2011-04-21 a645ba09d693495c50ab0ee0d1fc2734407b73a4
Added merge icon. Added commit legend with counts. Improved header.
8 files added
18 files modified
221 ■■■■ changed files
src/com/gitblit/utils/GitBlitDiffFormatter.java 6 ●●●●● patch | view | raw | blame | history
src/com/gitblit/utils/JGitUtils.java 12 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/GitBlitWebApp.properties 8 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/CommitDiffPage.html 9 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/CommitDiffPage.java 2 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/CommitPage.html 12 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/CommitPage.java 8 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/TicketPage.html 2 ●●● patch | view | raw | blame | history
src/com/gitblit/wicket/pages/TicketsPage.html 2 ●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/BranchesPanel.html 2 ●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/CommitLegendPanel.html 13 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/CommitLegendPanel.java 61 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/HistoryPanel.html 6 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/HistoryPanel.java 8 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/LogPanel.html 6 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/LogPanel.java 9 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/SearchPanel.html 6 ●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/SearchPanel.java 8 ●●●●● patch | view | raw | blame | history
src/com/gitblit/wicket/panels/TagsPanel.html 2 ●●● patch | view | raw | blame | history
src/com/gitblit/wicket/resources/background.png patch | view | raw | blame | history
src/com/gitblit/wicket/resources/commit_branch_16x16.png patch | view | raw | blame | history
src/com/gitblit/wicket/resources/commit_divide_16x16.png patch | view | raw | blame | history
src/com/gitblit/wicket/resources/commit_join_16x16.png patch | view | raw | blame | history
src/com/gitblit/wicket/resources/commit_merge_16x16.png patch | view | raw | blame | history
src/com/gitblit/wicket/resources/commit_up_16x16.png patch | view | raw | blame | history
src/com/gitblit/wicket/resources/gitblit.css 39 ●●●● patch | view | raw | blame | history
src/com/gitblit/utils/GitBlitDiffFormatter.java
@@ -97,6 +97,10 @@
                // 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 @@
                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');
            }
src/com/gitblit/utils/JGitUtils.java
@@ -15,6 +15,7 @@
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 @@
        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;
src/com/gitblit/wicket/GitBlitWebApp.properties
@@ -56,4 +56,10 @@
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
src/com/gitblit/wicket/pages/CommitDiffPage.html
@@ -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>
src/com/gitblit/wicket/pages/CommitDiffPage.java
@@ -20,6 +20,7 @@
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 @@
        // 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;
src/com/gitblit/wicket/pages/CommitPage.html
@@ -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>
src/com/gitblit/wicket/pages/CommitPage.java
@@ -19,6 +19,7 @@
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 @@
        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 @@
        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 @@
        };
        add(pathsView);
    }
    @Override
    protected String getPageName() {
        return getString("gb.commit");
src/com/gitblit/wicket/pages/TicketPage.html
@@ -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/>
src/com/gitblit/wicket/pages/TicketsPage.html
@@ -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>
src/com/gitblit/wicket/panels/BranchesPanel.html
@@ -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>
src/com/gitblit/wicket/panels/CommitLegendPanel.html
New 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>
src/com/gitblit/wicket/panels/CommitLegendPanel.java
New 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);
    }
}
src/com/gitblit/wicket/panels/HistoryPanel.html
@@ -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>
src/com/gitblit/wicket/panels/HistoryPanel.java
@@ -5,6 +5,7 @@
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 @@
                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()));
src/com/gitblit/wicket/panels/LogPanel.html
@@ -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>
src/com/gitblit/wicket/panels/LogPanel.java
@@ -5,6 +5,7 @@
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 @@
                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()));
src/com/gitblit/wicket/panels/SearchPanel.html
@@ -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>
src/com/gitblit/wicket/panels/SearchPanel.java
@@ -4,6 +4,7 @@
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 @@
                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
src/com/gitblit/wicket/panels/TagsPanel.html
@@ -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>
src/com/gitblit/wicket/resources/background.png
src/com/gitblit/wicket/resources/commit_branch_16x16.png
src/com/gitblit/wicket/resources/commit_divide_16x16.png
src/com/gitblit/wicket/resources/commit_join_16x16.png
src/com/gitblit/wicket/resources/commit_merge_16x16.png
src/com/gitblit/wicket/resources/commit_up_16x16.png
src/com/gitblit/wicket/resources/gitblit.css
@@ -20,6 +20,7 @@
    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 @@
    font-weight: bold;
    font-size: 150%;
    color: #888;
    background-color: #ffffff;
    background: transparent;
}
div.page_header span {    
@@ -313,6 +314,7 @@
    color: #999;
    padding-left: 5px;
    padding-right: 5px;
    width: 30px;
}
div.diff table th.header {
@@ -335,6 +337,10 @@
div.diff table td {
    border-left: 1px solid #bbb;
    background-color: #fbfbfb;
}
td.changeType {
    width: 15px;
}
span.addition, span.modification, span.deletion, span.rename {
@@ -360,6 +366,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 {
@@ -401,6 +423,9 @@
    border-right: 1px solid #bbb;    
}
table.pretty, table.comments, table.repositories {
    width:100%;
}
table.pretty td {
    padding: 2px 4px;
}
@@ -408,10 +433,6 @@
table.comments td {
    padding: 4px;
    line-height: 17px;
}
table.repositories {
    width:100%;
}
table.repositories th {
@@ -509,13 +530,13 @@
}
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 .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;
}