Also fixed /dev/null reference due to deletion change.
\r
# Specify the interface for Jetty to bind the standard connector.\r
# You may specify an ip or an empty value to bind to all interfaces. \r
-server.httpBindInterface = localhost\r
+server.httpBindInterface = \r
\r
# Specify the interface for Jetty to bind the secure connector.\r
# You may specify an ip or an empty value to bind to all interfaces.\r
-server.httpsBindInterface = localhost\r
+server.httpsBindInterface = \r
\r
# Password for SSL keystore (keystore password and certificate password must match)\r
server.storePassword = dosomegit\r
import org.eclipse.jgit.storage.file.FileRepository;\r
\r
import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.wicket.models.PathModel;\r
+import com.gitblit.wicket.models.PathModel.PathChangeModel;\r
import com.gitblit.wicket.models.RefModel;\r
import com.gitblit.wicket.models.TicketModel;\r
\r
public void testFilesInCommit() throws Exception {\r
Repository r = getRepository();\r
RevCommit commit = JGitUtils.getCommit(r, Constants.HEAD);\r
- List<PathModel> paths = JGitUtils.getFilesInCommit(r, commit);\r
+ List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, commit);\r
r.close();\r
assertTrue("No changed paths found!", paths.size() > 0);\r
}\r
import org.eclipse.jgit.diff.DiffEntry;\r
import org.eclipse.jgit.diff.DiffFormatter;\r
import org.eclipse.jgit.diff.RawTextComparator;\r
+import org.eclipse.jgit.diff.DiffEntry.ChangeType;\r
import org.eclipse.jgit.errors.ConfigInvalidException;\r
import org.eclipse.jgit.errors.IncorrectObjectTypeException;\r
import org.eclipse.jgit.errors.MissingObjectException;\r
\r
import com.gitblit.wicket.models.Metric;\r
import com.gitblit.wicket.models.PathModel;\r
+import com.gitblit.wicket.models.PathModel.PathChangeModel;\r
import com.gitblit.wicket.models.RefModel;\r
import com.gitblit.wicket.models.TicketModel;\r
import com.gitblit.wicket.models.TicketModel.Comment;\r
return list;\r
}\r
\r
- public static List<PathModel> getFilesInCommit(Repository r, String commitId) {\r
+ public static List<PathChangeModel> getFilesInCommit(Repository r, String commitId) {\r
RevCommit commit = getCommit(r, commitId);\r
return getFilesInCommit(r, commit);\r
}\r
\r
- public static List<PathModel> getFilesInCommit(Repository r, RevCommit commit) {\r
- List<PathModel> list = new ArrayList<PathModel>();\r
+ public static List<PathChangeModel> getFilesInCommit(Repository r, RevCommit commit) {\r
+ List<PathChangeModel> list = new ArrayList<PathChangeModel>();\r
try {\r
final RevWalk rw = new RevWalk(r);\r
RevCommit parent = rw.parseCommit(commit.getParent(0).getId());\r
df.setDetectRenames(true);\r
List<DiffEntry> diffs = df.scan(parentTree, commitTree);\r
for (DiffEntry diff : diffs) {\r
- list.add(new PathModel(diff.getNewPath(), diff.getNewPath(), 0, diff.getNewMode().getBits(), commit.getId().getName()));\r
+ if (diff.getChangeType().equals(ChangeType.DELETE)) {\r
+ list.add(new PathChangeModel(diff.getOldPath(), diff.getOldPath(), 0, diff.getNewMode().getBits(), commit.getId().getName(), diff.getChangeType()));\r
+ } else {\r
+ list.add(new PathChangeModel(diff.getNewPath(), diff.getNewPath(), 0, diff.getNewMode().getBits(), commit.getId().getName(), diff.getChangeType()));\r
+ }\r
}\r
} catch (Throwable t) {\r
LOGGER.error("failed to determine files in commit!", t);\r
gb.difftocurrent = diff to current\r
gb.search = search\r
gb.searchForAuthor = Search for commits authored by\r
-gb.searchForCommitter = Search for commits committed by
\ No newline at end of file
+gb.searchForCommitter = Search for commits committed by\r
+gb.addition = addition\r
+gb.modification = modification\r
+gb.deletion = deletion\r
+gb.rename = rename
\ No newline at end of file
import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.markup.html.panel.Fragment;\r
import org.apache.wicket.protocol.http.servlet.ServletWebRequest;\r
+import org.eclipse.jgit.diff.DiffEntry.ChangeType;\r
import org.eclipse.jgit.lib.PersonIdent;\r
import org.eclipse.jgit.lib.Repository;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
WicketUtils.setHtmlTitle(component, getString("gb.searchForCommitter") + " " + value);\r
}\r
}\r
+ \r
+ protected void setChangeTypeTooltip(Component container, ChangeType type) {\r
+ switch (type) {\r
+ case ADD:\r
+ WicketUtils.setHtmlTitle(container, getString("gb.addition"));\r
+ break;\r
+ case COPY:\r
+ case RENAME:\r
+ WicketUtils.setHtmlTitle(container, getString("gb.rename"));\r
+ break;\r
+ case DELETE:\r
+ WicketUtils.setHtmlTitle(container, getString("gb.deletion"));\r
+ break;\r
+ case MODIFY:\r
+ WicketUtils.setHtmlTitle(container, getString("gb.modification"));\r
+ break;\r
+ }\r
+ }\r
+ \r
@Override\r
protected void onBeforeRender() {\r
// dispose of repository object\r
import org.apache.wicket.PageParameters;\r
import org.apache.wicket.behavior.SimpleAttributeModifier;\r
import org.apache.wicket.markup.html.basic.Label;\r
+import org.eclipse.jgit.diff.DiffEntry.ChangeType;\r
import org.eclipse.jgit.lib.Constants;\r
\r
import com.gitblit.GitBlit;\r
container.add(new SimpleAttributeModifier("title", value));\r
}\r
\r
+ public static void setChangeTypeCssClass(Component container, ChangeType type) {\r
+ switch (type) {\r
+ case ADD:\r
+ setCssClass(container, "addition");\r
+ break;\r
+ case COPY:\r
+ case RENAME:\r
+ setCssClass(container, "rename");\r
+ break;\r
+ case DELETE:\r
+ setCssClass(container, "deletion");\r
+ break;\r
+ case MODIFY:\r
+ setCssClass(container, "modification");\r
+ break;\r
+ }\r
+ }\r
+\r
public static void setTicketCssClass(Component container, String state) {\r
String css = null;\r
if (state.equals("open")) {\r
\r
public static PageParameters newSearchParameter(String repositoryName, String commitId, String search, SearchType type) {\r
if (StringUtils.isEmpty(commitId)) {\r
- return new PageParameters("r=" + repositoryName + ",s=" + search + ",st=" + type.name()); \r
+ return new PageParameters("r=" + repositoryName + ",s=" + search + ",st=" + type.name());\r
}\r
return new PageParameters("r=" + repositoryName + ",h=" + commitId + ",s=" + search + ",st=" + type.name());\r
}\r
\r
import java.io.Serializable;\r
\r
+import org.eclipse.jgit.diff.DiffEntry.ChangeType;\r
+\r
import com.gitblit.utils.JGitUtils;\r
\r
public class PathModel implements Serializable, Comparable<PathModel> {\r
}\r
return 1;\r
}\r
+\r
+ public static class PathChangeModel extends PathModel {\r
+ \r
+ private static final long serialVersionUID = 1L;\r
+ \r
+ public final ChangeType changeType;\r
+\r
+ public PathChangeModel(String name, String path, long size, int mode, String commitId, ChangeType type) {\r
+ super(name, path, size, mode, commitId);\r
+ this.changeType = type;\r
+ }\r
+ }\r
}\r
<!-- changed paths -->\r
<table style="margin-top:10px;border-top:1px solid #bbb;" class="pretty">\r
<tr wicket:id="changedPath">\r
+ <td><span wicket:id="changeType">[change type]</span></td> \r
<td class="path"><span wicket:id="pathName">[commit path]</span></td> \r
<td>\r
<span class="link">\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.RepositoryPage;\r
import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.models.PathModel;\r
+import com.gitblit.wicket.models.PathModel.PathChangeModel;\r
\r
public class CommitDiffPage extends RepositoryPage {\r
\r
add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter()));\r
\r
// changed paths list\r
- List<PathModel> paths = JGitUtils.getFilesInCommit(r, commit);\r
- ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);\r
- DataView<PathModel> pathsView = new DataView<PathModel>("changedPath", pathsDp) {\r
+ List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, commit);\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
int counter = 0;\r
\r
- public void populateItem(final Item<PathModel> item) {\r
- final PathModel entry = item.getModelObject();\r
+ public void populateItem(final Item<PathChangeModel> item) {\r
+ final PathChangeModel entry = item.getModelObject();\r
+ Label changeType = new Label("changeType", "");\r
+ WicketUtils.setChangeTypeCssClass(changeType, entry.changeType);\r
+ setChangeTypeTooltip(changeType, entry.changeType);\r
+ item.add(changeType);\r
+\r
if (entry.isTree()) {\r
item.add(new LinkPanel("pathName", null, entry.path, TreePage.class, newPathParameter(entry.path)));\r
} else {\r
<!-- changed paths -->\r
<table style="border-top:1px solid #bbb;" class="pretty">\r
<tr wicket:id="changedPath">\r
+ <td><span wicket:id="changeType">[change type]</span></td>\r
<td class="path"><span wicket:id="pathName">[commit path]</span></td> \r
<td>\r
<span class="link">\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.RepositoryPage;\r
import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.models.PathModel;\r
+import com.gitblit.wicket.models.PathModel.PathChangeModel;\r
\r
public class CommitPage extends RepositoryPage {\r
\r
addFullText("fullMessage", c.getFullMessage(), true);\r
\r
// changed paths list\r
- List<PathModel> paths = JGitUtils.getFilesInCommit(r, c);\r
- ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);\r
- DataView<PathModel> pathsView = new DataView<PathModel>("changedPath", pathsDp) {\r
+ List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, c);\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
int counter = 0;\r
\r
- public void populateItem(final Item<PathModel> item) {\r
- final PathModel entry = item.getModelObject();\r
+ public void populateItem(final Item<PathChangeModel> item) {\r
+ final PathChangeModel entry = item.getModelObject();\r
+ Label changeType = new Label("changeType", "");\r
+ WicketUtils.setChangeTypeCssClass(changeType, entry.changeType);\r
+ setChangeTypeTooltip(changeType, entry.changeType);\r
+ item.add(changeType);\r
if (entry.isTree()) {\r
item.add(new LinkPanel("pathName", null, entry.path, TreePage.class, newPathParameter(entry.path)));\r
} else {\r
import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.utils.StringUtils;\r
import com.gitblit.utils.JGitUtils.SearchType;\r
+import com.gitblit.utils.StringUtils;\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.models.PathModel;\r
+import com.gitblit.wicket.models.PathModel.PathChangeModel;\r
import com.gitblit.wicket.pages.BlobDiffPage;\r
import com.gitblit.wicket.pages.BlobPage;\r
import com.gitblit.wicket.pages.CommitDiffPage;\r
}\r
\r
RevCommit commit = JGitUtils.getCommit(r, objectId);\r
- List<PathModel> paths = JGitUtils.getFilesInCommit(r, commit);\r
+ List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, commit);\r
\r
PathModel matchingPath = null;\r
for (PathModel p : paths) {\r
color:yellow;\r
text-align:right;\r
float:right;\r
- padding:3px;\r
+ padding:3px 4px 3px 3px; \r
}\r
\r
.repositories_message {\r
font-family: inherit;\r
}\r
\r
+span.addition, span.modification, span.deletion, span.rename {\r
+ border: 1px solid #888;\r
+ float: left;\r
+ height: 0.8em;\r
+ margin: 0.2em 0.5em 0 0;\r
+ overflow: hidden;\r
+ width: 0.8em;\r
+}\r
+\r
+span.addition {\r
+ background-color: #bbffbb;\r
+}\r
+\r
+span.modification {\r
+ background-color: #ffdd88;\r
+}\r
+\r
+span.deletion {\r
+ background-color: #ff8888;\r
+}\r
+\r
+span.rename {\r
+ background-color: #8888ff;\r
+}\r
+\r
a.list {\r
text-decoration: none;\r
color: #000000;\r