Added merge icon. Added commit legend with counts. Improved header.
8 files added
18 files modified
| | |
| | | // 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
|
| | |
| | | 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');
|
| | | }
|
| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
|
| | |
| | | gb.rename = rename
|
| | | gb.stats = stats
|
| | | 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 |
| | |
| | | <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>
|
| | |
| | | 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 {
|
| | |
|
| | |
| | |
|
| | | // 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;
|
| | |
| | | <!-- 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>
|
| | |
| | | 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 {
|
| | |
|
| | |
| | |
|
| | | // changed paths list
|
| | | 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;
|
| | |
| | | <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/>
|
| | |
| | | <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>
|
| | |
| | | <!-- 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>
|
New file |
| | |
| | | <!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> |
New file |
| | |
| | | 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);
|
| | | }
|
| | | } |
| | |
| | | <!-- 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>
|
| | |
| | | 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;
|
| | |
| | | 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()));
|
| | |
| | | <!-- 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>
|
| | |
| | | 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;
|
| | |
| | | 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()));
|
| | |
| | | <!-- 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>
|
| | |
| | | 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;
|
| | |
| | | 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
|
| | |
| | |
|
| | | <!-- 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>
|
| | |
| | | margin-left: auto;
|
| | | margin-top: none;
|
| | | padding: 0px;
|
| | | background: url(background.png) repeat-x scroll 0 0 #FFFFFF;
|
| | | }
|
| | |
|
| | | pre, code, pre.prettyprint, pre.plainprint {
|
| | |
| | | font-weight: bold;
|
| | | font-size: 150%;
|
| | | color: #888;
|
| | | background-color: #ffffff;
|
| | | background: transparent;
|
| | | }
|
| | |
|
| | | div.page_header span {
|
| | |
| | | color: #999;
|
| | | padding-left: 5px;
|
| | | padding-right: 5px;
|
| | | width: 30px;
|
| | | }
|
| | |
|
| | | div.diff table th.header {
|
| | |
| | | div.diff table td {
|
| | | border-left: 1px solid #bbb;
|
| | | background-color: #fbfbfb;
|
| | | }
|
| | |
|
| | | td.changeType {
|
| | | width: 15px;
|
| | | }
|
| | |
|
| | | span.addition, span.modification, span.deletion, span.rename {
|
| | |
| | |
|
| | | 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 {
|
| | |
| | | border-right: 1px solid #bbb;
|
| | | }
|
| | |
|
| | | table.pretty, table.comments, table.repositories {
|
| | | width:100%;
|
| | | }
|
| | | table.pretty td {
|
| | | padding: 2px 4px;
|
| | | }
|
| | |
| | | table.comments td {
|
| | | padding: 4px;
|
| | | line-height: 17px;
|
| | | }
|
| | |
|
| | | table.repositories {
|
| | | width:100%; |
| | | }
|
| | |
|
| | | table.repositories th {
|
| | |
| | | }
|
| | |
|
| | | span .tagRef, span .headRef, span .remoteRef, span .otherRef {
|
| | | padding: 0px 4px;
|
| | | padding: 0px 3px;
|
| | | margin-right:2px;
|
| | | font-family: sans-serif;
|
| | | font-size: 9px;
|
| | |
| | |
|
| | | 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;
|
| | | }
|
| | |
|