import org.eclipse.jgit.storage.file.FileRepository;\r
\r
import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.utils.TicGitTicket;\r
import com.gitblit.wicket.models.PathModel;\r
import com.gitblit.wicket.models.RefModel;\r
+import com.gitblit.wicket.models.TicGitTicket;\r
\r
public class JGitUtilsTest extends TestCase {\r
\r
\r
import static org.eclipse.jgit.lib.Constants.encodeASCII;\r
\r
+import java.io.ByteArrayOutputStream;\r
import java.io.IOException;\r
import java.io.OutputStream;\r
\r
import org.eclipse.jgit.diff.RawText;\r
\r
public class HtmlDiffFormatter extends DiffFormatter {\r
+ \r
private final OutputStream os;\r
\r
public HtmlDiffFormatter(OutputStream os) {\r
os.write(' ');\r
os.write('@');\r
os.write('@');\r
- // TODO not sure if JGit can determine hunk section\r
- //os.write("<span class=\"diff hunk_section\">".getBytes());\r
- //os.write("</span>".getBytes());\r
os.write("</span></div>".getBytes());\r
}\r
\r
protected void writeLine(final char prefix, final RawText text, final int cur) throws IOException {\r
switch (prefix) {\r
case '+':\r
- os.write("<div class=\"diff add\">".getBytes());\r
+ os.write("<span class=\"diff add\">".getBytes());\r
break;\r
case '-':\r
- os.write("<div class=\"diff remove\">".getBytes());\r
+ os.write("<span class=\"diff remove\">".getBytes());\r
break;\r
}\r
os.write(prefix);\r
- text.writeLine(os, cur);\r
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();\r
+ text.writeLine(bos, cur);\r
+ String line = bos.toString();\r
+ line = Utils.escapeForHtml(line, false);\r
+ os.write(line.getBytes());\r
switch (prefix) {\r
case '+':\r
case '-':\r
- os.write("</div>".getBytes());\r
+ os.write("</span>\n".getBytes());\r
break;\r
default:\r
os.write('\n');\r
if (line.startsWith("diff")) {\r
sb.append("<div class=\"diff header\">").append(line).append("</div>");\r
} else if (line.startsWith("---")) {\r
- sb.append("<div class=\"diff remove\">").append(line).append("</div>");\r
+ sb.append("<span class=\"diff remove\">").append(line).append("</span><br/>");\r
} else if (line.startsWith("+++")) {\r
- sb.append("<div class=\"diff add\">").append(line).append("</div>");\r
+ sb.append("<span class=\"diff add\">").append(line).append("</span><br/>");\r
} else {\r
sb.append(line).append('\n');\r
}\r
}\r
- sb.append("</div>");\r
+ sb.append("</div>\n");\r
return sb.toString();\r
}\r
}\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
-import com.gitblit.utils.TicGitTicket.Comment;\r
import com.gitblit.wicket.models.Metric;\r
import com.gitblit.wicket.models.PathModel;\r
import com.gitblit.wicket.models.RefModel;\r
+import com.gitblit.wicket.models.TicGitTicket;\r
+import com.gitblit.wicket.models.TicGitTicket.Comment;\r
\r
public class JGitUtils {\r
\r
return getCommitDate(commit);\r
}\r
\r
- public static RevCommit getCommit(Repository r, String commitId) {\r
+ public static RevCommit getCommit(Repository r, String objectId) {\r
RevCommit commit = null;\r
try {\r
- ObjectId objectId = r.resolve(commitId);\r
+ if (objectId == null || objectId.trim().length() == 0) {\r
+ objectId = Constants.HEAD;\r
+ }\r
+ ObjectId object = r.resolve(objectId);\r
RevWalk walk = new RevWalk(r);\r
- RevCommit rev = walk.parseCommit(objectId);\r
+ RevCommit rev = walk.parseCommit(object);\r
commit = rev;\r
walk.dispose();\r
} catch (Throwable t) {\r
return new String(getRawContent(r, (RevBlob) obj));\r
}\r
\r
- public static List<PathModel> getFilesInPath(Repository r, String basePath, String commitId) {\r
- RevCommit commit = getCommit(r, commitId);\r
+ public static List<PathModel> getFilesInPath(Repository r, String basePath, String objectId) {\r
+ RevCommit commit = getCommit(r, objectId);\r
return getFilesInPath(r, basePath, commit);\r
}\r
\r
walk.setRecursive(true);\r
walk.addTree(parentTree);\r
walk.addTree(commitTree);\r
- if (path != null && path.trim().length() > 0) {\r
- walk.setFilter(PathFilter.create(path));\r
- } else {\r
- walk.setFilter(TreeFilter.ANY_DIFF);\r
- }\r
+ walk.setFilter(TreeFilter.ANY_DIFF);\r
\r
final ByteArrayOutputStream os = new ByteArrayOutputStream();\r
RawTextComparator cmp = RawTextComparator.DEFAULT;\r
df.setDiffComparator(cmp);\r
df.setDetectRenames(true);\r
List<DiffEntry> diffs = df.scan(parentTree, commitTree);\r
- df.format(diffs);\r
+ if (path != null && path.length() > 0) {\r
+ for (DiffEntry diff : diffs) {\r
+ if (diff.getNewPath().equalsIgnoreCase(path)) {\r
+ df.format(diff);\r
+ break;\r
+ }\r
+ }\r
+ } else {\r
+ df.format(diffs);\r
+ }\r
String diff;\r
if (outputHtml) {\r
// workaround for complex private methods in DiffFormatter\r
}\r
return null;\r
}\r
+ \r
+ public static String getCommitPatch(Repository r, RevCommit commit) {\r
+ return getCommitPatch(r, commit);\r
+ }\r
+ \r
+ public static String getCommitPatch(Repository r, RevCommit commit, String path) {\r
+ try {\r
+ final RevWalk rw = new RevWalk(r);\r
+ RevCommit parent = rw.parseCommit(commit.getParent(0).getId());\r
+ RevTree parentTree = parent.getTree();\r
+ RevTree commitTree = commit.getTree();\r
+\r
+ final TreeWalk walk = new TreeWalk(r);\r
+ walk.reset();\r
+ walk.setRecursive(true);\r
+ walk.addTree(parentTree);\r
+ walk.addTree(commitTree);\r
+ walk.setFilter(TreeFilter.ANY_DIFF);\r
+\r
+ final ByteArrayOutputStream os = new ByteArrayOutputStream();\r
+ RawTextComparator cmp = RawTextComparator.DEFAULT;\r
+ PatchFormatter df = new PatchFormatter(os);\r
+ df.setRepository(r);\r
+ df.setDiffComparator(cmp);\r
+ df.setDetectRenames(true);\r
+ List<DiffEntry> diffs = df.scan(parentTree, commitTree);\r
+ if (path != null && path.length() > 0) {\r
+ for (DiffEntry diff : diffs) {\r
+ if (diff.getNewPath().equalsIgnoreCase(path)) {\r
+ df.format(diff);\r
+ break;\r
+ }\r
+ }\r
+ } else {\r
+ df.format(diffs);\r
+ }\r
+ String diff = df.getPatch(commit);\r
+ df.flush();\r
+ return diff;\r
+ } catch (Throwable t) {\r
+ LOGGER.error("failed to generate commit diff!", t);\r
+ }\r
+ return null;\r
+ }\r
\r
private static PathModel getPathModel(TreeWalk walk, String basePath, RevCommit commit) {\r
String name;\r
}\r
\r
public static List<Metric> getDateMetrics(Repository r) {\r
+ final List<RefModel> tags = getTags(r, -1);\r
final Map<String, Metric> map = new HashMap<String, Metric>();\r
try {\r
DateFormat df = new SimpleDateFormat("yyyy-MM");\r
--- /dev/null
+package com.gitblit.utils;\r
+\r
+import java.io.IOException;\r
+import java.io.OutputStream;\r
+import java.text.MessageFormat;\r
+import java.text.SimpleDateFormat;\r
+import java.util.Date;\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
+import org.eclipse.jgit.diff.DiffEntry;\r
+import org.eclipse.jgit.diff.DiffFormatter;\r
+import org.eclipse.jgit.diff.RawText;\r
+import org.eclipse.jgit.revwalk.RevCommit;\r
+\r
+import com.gitblit.Constants;\r
+\r
+public class PatchFormatter extends DiffFormatter {\r
+\r
+ private final OutputStream os;\r
+\r
+ private PatchTouple currentTouple = null;\r
+\r
+ Map<String, PatchTouple> changes = new HashMap<String, PatchTouple>();\r
+\r
+ public PatchFormatter(OutputStream os) {\r
+ super(os);\r
+ this.os = os;\r
+ }\r
+\r
+ public void format(DiffEntry entry) throws IOException {\r
+ currentTouple = new PatchTouple();\r
+ changes.put(entry.getNewPath(), currentTouple);\r
+ super.format(entry);\r
+ }\r
+\r
+ @Override\r
+ protected void writeLine(final char prefix, final RawText text, final int cur) throws IOException {\r
+ switch (prefix) {\r
+ case '+':\r
+ currentTouple.insertions++;\r
+ break;\r
+ case '-':\r
+ currentTouple.deletions++;\r
+ break;\r
+ }\r
+ super.writeLine(prefix, text, cur);\r
+ }\r
+\r
+ public String getPatch(RevCommit commit) {\r
+ StringBuilder patch = new StringBuilder();\r
+ // hard-code the mon sep 17 2001 date string.\r
+ // I have no idea why that is there. it seems to be a constant.\r
+ patch.append("From " + commit.getName() + " Mon Sep 17 00:00:00 2001" + "\n");\r
+ patch.append("From: " + JGitUtils.getDisplayName(commit.getAuthorIdent()) + "\n");\r
+ patch.append("Date: " + (new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z").format(new Date(commit.getCommitTime() * 1000l))) + "\n");\r
+ patch.append("Subject: [PATCH] " + commit.getShortMessage() + "\n");\r
+ patch.append("\n");\r
+ patch.append("---");\r
+ int maxPathLen = 0;\r
+ int files = 0;\r
+ int insertions = 0;\r
+ int deletions = 0;\r
+ for (String path : changes.keySet()) {\r
+ if (path.length() > maxPathLen) {\r
+ maxPathLen = path.length();\r
+ }\r
+ PatchTouple touple = changes.get(path);\r
+ files++;\r
+ insertions += touple.insertions;\r
+ deletions += touple.deletions;\r
+ }\r
+ int columns = 60;\r
+ int total = insertions + deletions;\r
+ int unit = total / columns + (total % columns > 0 ? 1 : 0);\r
+ if (unit == 0) {\r
+ unit = 1;\r
+ }\r
+ for (String path : changes.keySet()) {\r
+ PatchTouple touple = changes.get(path);\r
+ patch.append("\n " + Utils.rightPad(path, maxPathLen, ' ') + " | " + Utils.leftPad("" + touple.total(), 4, ' ') + " " + touple.relativeScale(unit));\r
+ }\r
+ patch.append(MessageFormat.format("\n {0} files changed, {1} insertions(+), {2} deletions(-)\n\n", files, insertions, deletions));\r
+ patch.append(os.toString());\r
+ patch.append("\n--\n");\r
+ patch.append(Constants.getRunningVersion());\r
+ return patch.toString();\r
+ }\r
+\r
+ private class PatchTouple {\r
+ int insertions = 0;\r
+ int deletions = 0;\r
+\r
+ int total() {\r
+ return insertions + deletions;\r
+ }\r
+\r
+ String relativeScale(int unit) {\r
+ int plus = (insertions / unit);\r
+ int minus = (deletions / unit);\r
+ StringBuilder sb = new StringBuilder();\r
+ for (int i = 0; i < plus; i++) {\r
+ sb.append('+');\r
+ }\r
+ for (int i = 0; i < minus; i++) {\r
+ sb.append('-');\r
+ }\r
+ return sb.toString();\r
+ }\r
+ }\r
+}\r
+++ /dev/null
-package com.gitblit.utils;\r
-\r
-import java.io.Serializable;\r
-import java.text.ParseException;\r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.Date;\r
-import java.util.List;\r
-\r
-import com.gitblit.wicket.models.PathModel;\r
-\r
-public class TicGitTicket implements Serializable, Comparable<TicGitTicket> {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public String id;\r
- public String name;\r
- public String title;\r
- public String state;\r
- public Date date;\r
- public String handler;\r
- public String milestone;\r
- public String email;\r
- public String author;\r
- public List<Comment> comments;\r
- public List<String> tags;\r
-\r
- public TicGitTicket() {\r
- state = "open";\r
- comments = new ArrayList<Comment>();\r
- tags = new ArrayList<String>();\r
- }\r
-\r
- public TicGitTicket(String ticketName) throws ParseException {\r
- state = "";\r
- name = ticketName;\r
- comments = new ArrayList<Comment>();\r
- tags = new ArrayList<String>();\r
-\r
- String[] chunks = name.split("_");\r
- if (chunks.length == 3) {\r
- date = new Date(Long.parseLong(chunks[0]) * 1000l);\r
- title = chunks[1].replace('-', ' ');\r
- } \r
- }\r
-\r
- public static class Comment implements Serializable, Comparable<Comment> {\r
- \r
- private static final long serialVersionUID = 1L;\r
- \r
- public String text;\r
- public String author;\r
- public Date date;\r
-\r
- public Comment(String text, Date date) {\r
- this.text = text;\r
- this.date = date;\r
- }\r
-\r
- public Comment(String filename, String content) throws ParseException {\r
- String[] chunks = filename.split("_", -1);\r
- this.date = new Date(Long.parseLong(chunks[1]) * 1000l);\r
- this.author = chunks[2];\r
- this.text = content;\r
- }\r
-\r
- @Override\r
- public int compareTo(Comment o) {\r
- return date.compareTo(o.date);\r
- }\r
- }\r
-\r
- @Override\r
- public int compareTo(TicGitTicket o) {\r
- return date.compareTo(o.date);\r
- }\r
-}\r
}\r
return ago;\r
}\r
+ \r
+ public static String leftPad(String input, int length, char pad) {\r
+ if (input.length() < length) {\r
+ StringBuilder sb = new StringBuilder();\r
+ for (int i = 0, len = length - input.length(); i < len; i++) {\r
+ sb.append(pad);\r
+ }\r
+ sb.append(input);\r
+ return sb.toString();\r
+ }\r
+ return input;\r
+ }\r
+ \r
+ public static String rightPad(String input, int length, char pad) {\r
+ if (input.length() < length) {\r
+ StringBuilder sb = new StringBuilder();\r
+ sb.append(input);\r
+ for (int i = 0, len = length - input.length(); i < len; i++) {\r
+ sb.append(pad);\r
+ } \r
+ return sb.toString();\r
+ }\r
+ return input;\r
+ }\r
+ \r
+ public static String escapeForHtml(String inStr, boolean changeSpace) {\r
+ StringBuffer retStr = new StringBuffer();\r
+ int i = 0;\r
+ while (i < inStr.length()) {\r
+ if (inStr.charAt(i) == '&') {\r
+ retStr.append("&");\r
+ } else if (inStr.charAt(i) == '<') {\r
+ retStr.append("<");\r
+ } else if (inStr.charAt(i) == '>') {\r
+ retStr.append(">");\r
+ } else if (inStr.charAt(i) == '\"') {\r
+ retStr.append(""");\r
+ } else if (changeSpace && inStr.charAt(i) == ' ') {\r
+ retStr.append(" ");\r
+ } else if (changeSpace && inStr.charAt(i) == '\t') {\r
+ retStr.append(" ");\r
+ } else\r
+ retStr.append(inStr.charAt(i));\r
+ i++;\r
+ }\r
+ return retStr.toString();\r
+ }\r
}\r
import com.gitblit.StoredSettings;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.wicket.models.RepositoryModel;\r
+import com.gitblit.wicket.pages.BlobDiffPage;\r
import com.gitblit.wicket.pages.BlobPage;\r
import com.gitblit.wicket.pages.BranchesPage;\r
import com.gitblit.wicket.pages.CommitPage;\r
-import com.gitblit.wicket.pages.DiffPage;\r
-import com.gitblit.wicket.pages.RepositoriesPage;\r
+import com.gitblit.wicket.pages.CommitDiffPage;\r
import com.gitblit.wicket.pages.LogPage;\r
+import com.gitblit.wicket.pages.PatchPage;\r
+import com.gitblit.wicket.pages.RawPage;\r
+import com.gitblit.wicket.pages.RepositoriesPage;\r
import com.gitblit.wicket.pages.SummaryPage;\r
import com.gitblit.wicket.pages.TagPage;\r
import com.gitblit.wicket.pages.TagsPage;\r
mount(new MixedParamUrlCodingStrategy("/tag", TagPage.class, new String[] { "r", "h" }));\r
mount(new MixedParamUrlCodingStrategy("/tree", TreePage.class, new String[] { "r", "h", "f" }));\r
mount(new MixedParamUrlCodingStrategy("/blob", BlobPage.class, new String[] { "r", "h", "f" }));\r
- mount(new MixedParamUrlCodingStrategy("/diff", DiffPage.class, new String[] { "r", "h", "f" }));\r
+ mount(new MixedParamUrlCodingStrategy("/raw", RawPage.class, new String[] { "r", "h", "f" }));\r
+ mount(new MixedParamUrlCodingStrategy("/blobdiff", BlobDiffPage.class, new String[] { "r", "h", "f" }));\r
+ mount(new MixedParamUrlCodingStrategy("/commitdiff", CommitDiffPage.class, new String[] { "r", "h" }));\r
+ mount(new MixedParamUrlCodingStrategy("/patch", PatchPage.class, new String[] { "r", "h", "f" }));\r
\r
// setup extended urls\r
mount(new MixedParamUrlCodingStrategy("/ticgit", TicGitPage.class, new String[] { "p" }));\r
gb.pageFirst = first\r
gb.pagePrevious prev\r
gb.pageNext = next\r
-gb.parent = parent
\ No newline at end of file
+gb.parent = parent\r
+gb.head = HEAD\r
+gb.blame = blame
\ No newline at end of file
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.lib.Constants;\r
\r
import com.gitblit.StoredSettings;\r
import com.gitblit.utils.Utils;\r
}\r
\r
public static String getObject(PageParameters params) {\r
- return params.getString("h", "");\r
+ return params.getString("h", Constants.HEAD);\r
}\r
\r
public static String getPath(PageParameters params) {\r
--- /dev/null
+package com.gitblit.wicket.models;\r
+\r
+import java.io.Serializable;\r
+import java.text.ParseException;\r
+import java.util.ArrayList;\r
+import java.util.Date;\r
+import java.util.List;\r
+\r
+public class TicGitTicket implements Serializable, Comparable<TicGitTicket> {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public String id;\r
+ public String name;\r
+ public String title;\r
+ public String state;\r
+ public Date date;\r
+ public String handler;\r
+ public String milestone;\r
+ public String email;\r
+ public String author;\r
+ public List<Comment> comments;\r
+ public List<String> tags;\r
+\r
+ public TicGitTicket() {\r
+ state = "open";\r
+ comments = new ArrayList<Comment>();\r
+ tags = new ArrayList<String>();\r
+ }\r
+\r
+ public TicGitTicket(String ticketName) throws ParseException {\r
+ state = "";\r
+ name = ticketName;\r
+ comments = new ArrayList<Comment>();\r
+ tags = new ArrayList<String>();\r
+\r
+ String[] chunks = name.split("_");\r
+ if (chunks.length == 3) {\r
+ date = new Date(Long.parseLong(chunks[0]) * 1000l);\r
+ title = chunks[1].replace('-', ' ');\r
+ } \r
+ }\r
+\r
+ public static class Comment implements Serializable, Comparable<Comment> {\r
+ \r
+ private static final long serialVersionUID = 1L;\r
+ \r
+ public String text;\r
+ public String author;\r
+ public Date date;\r
+\r
+ public Comment(String text, Date date) {\r
+ this.text = text;\r
+ this.date = date;\r
+ }\r
+\r
+ public Comment(String filename, String content) throws ParseException {\r
+ String[] chunks = filename.split("_", -1);\r
+ this.date = new Date(Long.parseLong(chunks[1]) * 1000l);\r
+ this.author = chunks[2];\r
+ this.text = content;\r
+ }\r
+\r
+ @Override\r
+ public int compareTo(Comment o) {\r
+ return date.compareTo(o.date);\r
+ }\r
+ }\r
+\r
+ @Override\r
+ public int compareTo(TicGitTicket o) {\r
+ return date.compareTo(o.date);\r
+ }\r
+}\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
+<body>\r
+<wicket:extend>\r
+\r
+ <!-- page nav links --> \r
+ <div wicket:id="pageLinks">[page links]</div>\r
+ \r
+ <!-- blob nav links --> \r
+ <div class="page_nav2">\r
+ <span wicket:id="blameLink">[blame link]</span> | <span wicket:id="historyLink">[history 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> | <a wicket:id="commitDiffLink"><wicket:message key="gb.commitdiff"></wicket:message></a>\r
+ </div> \r
+ \r
+ <!-- shortlog header -->\r
+ <div class="header" wicket:id="shortlog">[shortlog header]</div>\r
+\r
+ <!-- breadcrumbs -->\r
+ <div wicket:id="breadcrumbs">[breadcrumbs]</div>\r
+ \r
+ <!-- diff content -->\r
+ <pre wicket:id="diffText">[diff text]</pre>\r
+ \r
+</wicket:extend>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+package com.gitblit.wicket.pages;\r
+\r
+import org.apache.wicket.PageParameters;\r
+import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
+import org.eclipse.jgit.lib.Repository;\r
+import org.eclipse.jgit.revwalk.RevCommit;\r
+\r
+import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.wicket.LinkPanel;\r
+import com.gitblit.wicket.RepositoryPage;\r
+import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.panels.PathBreadcrumbsPanel;\r
+\r
+public class BlobDiffPage extends RepositoryPage {\r
+\r
+ public BlobDiffPage(PageParameters params) {\r
+ super(params);\r
+\r
+ final String blobPath = WicketUtils.getPath(params);\r
+\r
+ Repository r = getRepository();\r
+ RevCommit commit = JGitUtils.getCommit(r, objectId);\r
+ String diff = JGitUtils.getCommitDiff(r, commit, blobPath, true);\r
+ add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class, WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));\r
+ add(new BookmarkablePageLink<Void>("commitLink", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));\r
+ add(new BookmarkablePageLink<Void>("commitDiffLink", CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));\r
+\r
+ // diff page links\r
+ add(new Label("blameLink", getString("gb.blame")));\r
+ add(new Label("historyLink", getString("gb.history")));\r
+\r
+ add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter()));\r
+\r
+ add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId));\r
+ \r
+ add(new Label("diffText", diff).setEscapeModelStrings(false));\r
+ }\r
+ \r
+ @Override\r
+ protected String getPageName() {\r
+ return getString("gb.diff");\r
+ }\r
+}\r
\r
<!-- blob nav links --> \r
<div class="page_nav2">\r
- <span wicket:id="historyLink">[history link]</span> | <span wicket:id="rawLink">[raw link]</span> | <span wicket:id="headLink">[head link]</span>\r
+ <span wicket:id="blameLink">[blame link]</span> | <span wicket:id="historyLink">[history link]</span> | <a wicket:id="rawLink"><wicket:message key="gb.raw"></wicket:message></a> | <a wicket:id="headLink"><wicket:message key="gb.head"></wicket:message></a>\r
</div> \r
\r
<!-- shortlog header -->\r
import org.apache.wicket.Component;\r
import org.apache.wicket.PageParameters;\r
import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
+import org.eclipse.jgit.lib.Constants;\r
import org.eclipse.jgit.lib.Repository;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
RevCommit commit = JGitUtils.getCommit(r, objectId);\r
\r
// blob page links\r
+ add(new Label("blameLink", getString("gb.blame")));\r
add(new Label("historyLink", getString("gb.history")));\r
- add(new Label("rawLink", getString("gb.raw")));\r
- add(new Label("headLink", "HEAD"));\r
+ add(new BookmarkablePageLink<Void>("rawLink", RawPage.class, WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));\r
+ add(new BookmarkablePageLink<Void>("headLink", BlobPage.class, WicketUtils.newPathParameter(repositoryName, Constants.HEAD, blobPath)));\r
\r
add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter()));\r
\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
+<body>\r
+<wicket:extend>\r
+\r
+ <!-- page nav links --> \r
+ <div wicket:id="pageLinks">[page links]</div>\r
+ \r
+ <!-- commitdiff nav links --> \r
+ <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
+ <!-- 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
+ <tr wicket:id="changedPath">\r
+ <td class="path"><span wicket:id="pathName">[commit path]</span></td> \r
+ <td>\r
+ <div 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
+ </div>\r
+ </td>\r
+ </tr>\r
+ </table>\r
+ \r
+ <!-- diff content -->\r
+ <pre wicket:id="diffText">[diff text]</pre>\r
+ \r
+</wicket:extend>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+package com.gitblit.wicket.pages;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.apache.wicket.PageParameters;\r
+import org.apache.wicket.markup.html.basic.Label;\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
+import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
+import org.eclipse.jgit.lib.Repository;\r
+import org.eclipse.jgit.revwalk.RevCommit;\r
+\r
+import com.gitblit.utils.JGitUtils;\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
+\r
+public class CommitDiffPage extends RepositoryPage {\r
+\r
+ public CommitDiffPage(PageParameters params) {\r
+ super(params);\r
+\r
+ Repository r = getRepository();\r
+ RevCommit commit = JGitUtils.getCommit(r, objectId);\r
+ String diff = JGitUtils.getCommitDiff(r, commit, true); \r
+ \r
+ List<String> parents = new ArrayList<String>();\r
+ if (commit.getParentCount() > 0) {\r
+ for (RevCommit parent : commit.getParents()) {\r
+ parents.add(parent.name());\r
+ }\r
+ }\r
+ \r
+ // commit page links\r
+ if (parents.size() == 0) {\r
+ add(new Label("parentLink", "none"));\r
+ } else {\r
+ add(new LinkPanel("parentLink", null, parents.get(0).substring(0, 8), CommitDiffPage.class, newCommitParameter(parents.get(0))));\r
+ }\r
+ add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));\r
+ add(new BookmarkablePageLink<Void>("commitLink", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));\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
+ 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
+ if (entry.isTree()) {\r
+ item.add(new LinkPanel("pathName", null, entry.path, TreePage.class, newPathParameter(entry.path)));\r
+ } else {\r
+ item.add(new LinkPanel("pathName", "list", entry.path, BlobPage.class, newPathParameter(entry.path)));\r
+ }\r
+ \r
+ item.add(new BookmarkablePageLink<Void>("patch", PatchPage.class, newPathParameter(entry.path)));\r
+ item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, newPathParameter(entry.path)));\r
+ item.add(new BookmarkablePageLink<Void>("blame", BlobPage.class).setEnabled(false));\r
+ item.add(new BookmarkablePageLink<Void>("history", BlobPage.class).setEnabled(false));\r
+\r
+ WicketUtils.setAlternatingBackground(item, counter);\r
+ counter++;\r
+ }\r
+ };\r
+ add(pathsView);\r
+ add(new Label("diffText", diff).setEscapeModelStrings(false));\r
+ }\r
+ \r
+ @Override\r
+ protected String getPageName() {\r
+ return getString("gb.commitdiff");\r
+ }\r
+}\r
\r
<!-- commit nav links --> \r
<div class="page_nav2">\r
- <wicket:message key="gb.parent"></wicket:message>: <span wicket:id="parentLink">[parent link]</span> | <span wicket:id="patchLink">[patch link]</span> | <span wicket:id="commitdiffLink">[commitdiff link]</span>\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> | <span wicket:id="commitdiffLink">[commitdiff link]</span>\r
</div> \r
\r
<!-- shortlog header -->\r
<td class="path"><span wicket:id="pathName">[commit path]</span></td> \r
<td>\r
<div 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="history"><wicket:message key="gb.history"></wicket:message></a>\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
</div>\r
</td>\r
</tr>\r
add(new Label("commitdiffLink", getString("gb.commitdiff")));\r
} else {\r
add(new LinkPanel("parentLink", null, parents.get(0).substring(0, 8), CommitPage.class, newCommitParameter(parents.get(0))));\r
- add(new LinkPanel("commitdiffLink", null, new StringResourceModel("gb.commitdiff", this, null), DiffPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));\r
+ add(new LinkPanel("commitdiffLink", null, new StringResourceModel("gb.commitdiff", this, null), CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));\r
}\r
- add(new Label("patchLink", getString("gb.patch")));\r
+ add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));\r
\r
- add(new LinkPanel("shortlog", "title", c.getShortMessage(), LogPage.class, newRepositoryParameter()));\r
+ add(new LinkPanel("shortlog", "title", c.getShortMessage(), CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));\r
\r
addRefs(r, c);\r
\r
item.add(new LinkPanel("pathName", "list", entry.path, BlobPage.class, newPathParameter(entry.path)));\r
}\r
\r
- item.add(new BookmarkablePageLink<Void>("diff", DiffPage.class, newPathParameter(entry.path)));\r
+ item.add(new BookmarkablePageLink<Void>("diff", BlobDiffPage.class, newPathParameter(entry.path)));\r
item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, newPathParameter(entry.path)));\r
+ item.add(new BookmarkablePageLink<Void>("blame", BlobPage.class).setEnabled(false));\r
item.add(new BookmarkablePageLink<Void>("history", BlobPage.class).setEnabled(false));\r
\r
WicketUtils.setAlternatingBackground(item, counter);\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
-<body>\r
-<wicket:extend>\r
-\r
- <!-- page nav links --> \r
- <div wicket:id="pageLinks">[page links]</div>\r
- \r
- <!-- blob nav links --> \r
- <div class="page_nav2">\r
- <span wicket:id="historyLink">[history link]</span> | <span wicket:id="rawLink">[raw link]</span> | <span wicket:id="headLink">[head link]</span>\r
- </div> \r
- \r
- <!-- shortlog header -->\r
- <div class="header" wicket:id="shortlog">[shortlog header]</div>\r
-\r
- <!-- breadcrumbs -->\r
- <div wicket:id="breadcrumbs">[breadcrumbs]</div>\r
- \r
- <!-- diff content -->\r
- <pre wicket:id="diffText">[diff text]</pre>\r
- \r
-</wicket:extend>\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-package com.gitblit.wicket.pages;\r
-\r
-import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.basic.Label;\r
-import org.eclipse.jgit.lib.Repository;\r
-import org.eclipse.jgit.revwalk.RevCommit;\r
-\r
-import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.wicket.LinkPanel;\r
-import com.gitblit.wicket.RepositoryPage;\r
-import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.panels.PathBreadcrumbsPanel;\r
-\r
-public class DiffPage extends RepositoryPage {\r
-\r
- public DiffPage(PageParameters params) {\r
- super(params);\r
-\r
- final String blobPath = WicketUtils.getPath(params);\r
-\r
- Repository r = getRepository();\r
- RevCommit commit = JGitUtils.getCommit(r, objectId);\r
- String diff;\r
- if (blobPath != null && blobPath.length() > 0) {\r
- // blob diff\r
- diff = JGitUtils.getCommitDiff(r, commit, blobPath, true);\r
- } else {\r
- // commit diff\r
- diff = JGitUtils.getCommitDiff(r, commit, true);\r
- }\r
-\r
- // diff page links\r
- add(new Label("historyLink", getString("gb.history")));\r
- add(new Label("rawLink", getString("gb.raw")));\r
- add(new Label("headLink", "HEAD"));\r
-\r
- add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter()));\r
-\r
- add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId));\r
-\r
- add(new Label("diffText", diff).setEscapeModelStrings(false));\r
- }\r
- \r
- @Override\r
- protected String getPageName() {\r
- return getString("gb.diff");\r
- }\r
-}\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
+<body>\r
+\r
+ <!-- patch content -->\r
+ <pre style="border:0px;" wicket:id="patchText">[patch content]</pre>\r
+ \r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+package com.gitblit.wicket.pages;\r
+\r
+import javax.servlet.http.HttpServletRequest;\r
+\r
+import org.apache.wicket.PageParameters;\r
+import org.apache.wicket.markup.html.WebPage;\r
+import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.protocol.http.servlet.ServletWebRequest;\r
+import org.eclipse.jgit.lib.Repository;\r
+import org.eclipse.jgit.revwalk.RevCommit;\r
+\r
+import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.wicket.GitBlitWebApp;\r
+import com.gitblit.wicket.WicketUtils;\r
+\r
+\r
+public class PatchPage extends WebPage {\r
+\r
+ public PatchPage(PageParameters params) {\r
+ super(params);\r
+\r
+ if (!params.containsKey("r")) {\r
+ error("Repository not specified!");\r
+ redirectToInterceptPage(new RepositoriesPage());\r
+ }\r
+ final String repositoryName = WicketUtils.getRepositoryName(params);\r
+ final String objectId = WicketUtils.getObject(params); \r
+ final String blobPath = WicketUtils.getPath(params);\r
+\r
+ ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest();\r
+ HttpServletRequest req = servletWebRequest.getHttpServletRequest();\r
+ req.getServerName();\r
+\r
+ Repository r = GitBlitWebApp.get().getRepository(req, repositoryName);\r
+ if (r == null) {\r
+ error("Can not load repository " + repositoryName);\r
+ redirectToInterceptPage(new RepositoriesPage());\r
+ return;\r
+ }\r
+\r
+ RevCommit commit = JGitUtils.getCommit(r, objectId);\r
+ String patch = JGitUtils.getCommitPatch(r, commit, blobPath);\r
+ add(new Label("patchText", patch));\r
+ r.close();\r
+ } \r
+}\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
+<body>\r
+\r
+ <!-- raw content -->\r
+ <pre style="border:0px;" wicket:id="rawText">[raw content]</pre>\r
+ \r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+package com.gitblit.wicket.pages;\r
+\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
+import javax.servlet.http.HttpServletRequest;\r
+\r
+import org.apache.wicket.Component;\r
+import org.apache.wicket.PageParameters;\r
+import org.apache.wicket.markup.html.WebPage;\r
+import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.protocol.http.servlet.ServletWebRequest;\r
+import org.eclipse.jgit.lib.Repository;\r
+import org.eclipse.jgit.revwalk.RevCommit;\r
+\r
+import com.gitblit.StoredSettings;\r
+import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.wicket.GitBlitWebApp;\r
+import com.gitblit.wicket.WicketUtils;\r
+\r
+\r
+public class RawPage extends WebPage {\r
+\r
+ public RawPage(PageParameters params) {\r
+ super(params);\r
+\r
+ if (!params.containsKey("r")) {\r
+ error("Repository not specified!");\r
+ redirectToInterceptPage(new RepositoriesPage());\r
+ }\r
+ final String repositoryName = WicketUtils.getRepositoryName(params);\r
+ final String objectId = WicketUtils.getObject(params); \r
+ final String blobPath = WicketUtils.getPath(params);\r
+\r
+ ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest();\r
+ HttpServletRequest req = servletWebRequest.getHttpServletRequest();\r
+ req.getServerName();\r
+\r
+ Repository r = GitBlitWebApp.get().getRepository(req, repositoryName);\r
+ if (r == null) {\r
+ error("Can not load repository " + repositoryName);\r
+ redirectToInterceptPage(new RepositoriesPage());\r
+ return;\r
+ }\r
+\r
+ RevCommit commit = JGitUtils.getCommit(r, objectId);\r
+\r
+ String extension = null;\r
+ if (blobPath.lastIndexOf('.') > -1) {\r
+ extension = blobPath.substring(blobPath.lastIndexOf('.') + 1);\r
+ }\r
+\r
+ // Map the extensions to types\r
+ Map<String, Integer> map = new HashMap<String, Integer>();\r
+ for (String ext : StoredSettings.getStrings("imageExtensions")) {\r
+ map.put(ext.toLowerCase(), 2);\r
+ }\r
+ for (String ext : StoredSettings.getStrings("binaryExtensions")) {\r
+ map.put(ext.toLowerCase(), 3);\r
+ }\r
+\r
+ if (extension != null) {\r
+ int type = 0;\r
+ if (map.containsKey(extension)) {\r
+ type = map.get(extension);\r
+ }\r
+ Component c = null;\r
+ switch (type) {\r
+ case 2:\r
+ // TODO image blobs\r
+ c = new Label("rawText", "Image File");\r
+ break;\r
+ case 3:\r
+ // TODO binary blobs\r
+ c = new Label("rawText", "Binary File");\r
+ break;\r
+ default:\r
+ // plain text\r
+ c = new Label("rawText", JGitUtils.getRawContentAsString(r, commit, blobPath));\r
+ WicketUtils.setCssClass(c, "plainprint");\r
+ }\r
+ add(c);\r
+ } else {\r
+ // plain text\r
+ Label blobLabel = new Label("rawText", JGitUtils.getRawContentAsString(r, commit, blobPath));\r
+ WicketUtils.setCssClass(blobLabel, "plainprint");\r
+ add(blobLabel);\r
+ }\r
+ r.close();\r
+ } \r
+}\r
<div wicket:id="pageLinks">[page links]</div>\r
\r
<!-- summary header -->\r
- <div style="padding-top: 5px;" class="header" wicket:id="commit">[shortlog header]</div>\r
+ <div style="margin-top: 5px;" class="header" wicket:id="commit">[shortlog header]</div>\r
\r
<!-- commit info -->\r
<table class="plain">\r
package com.gitblit.wicket.pages;\r
\r
+import java.util.List;\r
+\r
import org.apache.wicket.PageParameters;\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.eclipse.jgit.lib.Repository;\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.RepositoryPage;\r
import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.models.RefModel;\r
\r
\r
public class TagPage extends RepositoryPage {\r
public TagPage(PageParameters params) {\r
super(params);\r
\r
- Repository r = getRepository();\r
+ Repository r = getRepository(); \r
+ List<RefModel> tags = JGitUtils.getTags(r, -1);\r
RevCommit c = JGitUtils.getCommit(r, objectId);\r
-\r
- add(new LinkPanel("commit", "title", c.getName(), CommitPage.class, newCommitParameter()));\r
+ \r
+ String name = c.getName();\r
+ for (RefModel tag:tags) {\r
+ if (tag.getName().equals(objectId)) {\r
+ name = tag.getDisplayName();\r
+ }\r
+ }\r
+\r
+ add(new LinkPanel("commit", "title", name, CommitPage.class, newCommitParameter()));\r
\r
add(new LinkPanel("tagId", "list", c.getName(), CommitPage.class, newCommitParameter(c.getName())));\r
add(new Label("tagAuthor", JGitUtils.getDisplayName(c.getAuthorIdent())));\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
\r
import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.utils.TicGitTicket;\r
import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.RepositoryPage;\r
import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.models.TicGitTicket;\r
\r
public class TicGitPage extends RepositoryPage {\r
\r
import org.eclipse.jgit.lib.Repository;\r
\r
import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.utils.TicGitTicket;\r
-import com.gitblit.utils.TicGitTicket.Comment;\r
import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.RepositoryPage;\r
import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.models.TicGitTicket;\r
+import com.gitblit.wicket.models.TicGitTicket.Comment;\r
\r
public class TicGitTicketPage extends RepositoryPage {\r
\r
\r
<!-- blob nav links --> \r
<div class="page_nav2">\r
- <span wicket:id="historyLink">[history link]</span> | <span wicket:id="headLink">[head link]</span>\r
+ <span wicket:id="historyLink">[history link]</span> | <a wicket:id="headLink"><wicket:message key="gb.head"></wicket:message></a>\r
</div> \r
\r
<!-- shortlog header -->\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.lib.Constants;\r
import org.eclipse.jgit.lib.Repository;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
\r
// tree page links\r
add(new Label("historyLink", getString("gb.history")));\r
- add(new Label("headLink", "HEAD"));\r
+ add(new BookmarkablePageLink<Void>("headLink", TreePage.class, WicketUtils.newPathParameter(repositoryName, Constants.HEAD, basePath)));\r
+\r
\r
add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter()));\r
\r
// links\r
Fragment links = new Fragment("pathLinks", "blobLinks", this);\r
links.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));\r
- links.add(new BookmarkablePageLink<Void>("raw", BlobPage.class).setEnabled(false));\r
+ links.add(new BookmarkablePageLink<Void>("raw", RawPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));\r
links.add(new BookmarkablePageLink<Void>("history", BlobPage.class).setEnabled(false));\r
item.add(links);\r
}\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.pages.CommitPage;\r
-import com.gitblit.wicket.pages.DiffPage;\r
+import com.gitblit.wicket.pages.CommitDiffPage;\r
import com.gitblit.wicket.pages.LogPage;\r
import com.gitblit.wicket.pages.SummaryPage;\r
import com.gitblit.wicket.pages.TreePage;\r
item.add(new RefsPanel("commitRefs", repositoryName, entry, allRefs));\r
\r
item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));\r
- item.add(new BookmarkablePageLink<Void>("diff", DiffPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));\r
+ item.add(new BookmarkablePageLink<Void>("diff", CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));\r
item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));\r
\r
WicketUtils.setAlternatingBackground(item, counter);\r
background-color: #EDECE6;\r
border-color: #D9D8D1;\r
border-style: solid;\r
- border-width: 1px 0;\r
+ border-width: 1px;\r
font-weight: bold;\r
- margin-top: 4px;\r
+ margin-top: 10px;\r
padding: 4px 0 2px;\r
}\r
\r
font-family: inherit;\r
}\r
\r
-div.diff.add {\r
+span.diff.add {\r
color: #008800;\r
font-family: inherit;\r
}\r
\r
-div.diff.remove {\r
+span.diff.remove {\r
color: #cc0000;\r
font-family: inherit;\r
}\r
\r
-div.diff.unchanged {\r
+span.diff.unchanged {\r
color: inherit;\r
font-family: inherit;\r
}\r
\r
span .tagRef a, span .headRef a, span .remoteRef a, span .otherRef a {\r
text-decoration: none;\r
- color: inherit;\r
+ color: black;\r
}\r
\r
span .tagRef a:hover, span .headRef a:hover, span .remoteRef a:hover, span .otherRef a:hover {\r
- color: inherit;\r
+ color: black;\r
+ text-decoration: underline;\r
}\r
\r
span .otherRef {\r