border-width: 1px 0px 1px;\r
}\r
\r
+div.bug_open {\r
+ padding: 2px;\r
+ background-color: #800000;\r
+ color: white; \r
+ text-align: center;\r
+}\r
+\r
+div.bug_resolved {\r
+ padding: 2px;\r
+ background-color: #008000;\r
+ color: white;\r
+ text-align: center;\r
+}\r
+\r
+div.bug_invalid {\r
+ padding: 2px;\r
+ background-color: gray;\r
+ text-align: center;\r
+}\r
+\r
+div.bug_hold {\r
+ padding: 2px;\r
+ background-color: orange;\r
+ text-align: center;\r
+}\r
+\r
a.list {\r
text-decoration: none;\r
color: #000000;\r
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.RefModel;\r
\r
\r
public class JGitUtilsTest extends TestCase {\r
r.close();\r
assertTrue("Content is null!", content != null);\r
}\r
+ \r
+ public void testTicGit() throws Exception {\r
+ Repository r = new FileRepository(new File(repositoriesFolder, "ticgit") + "/" + Constants.DOT_GIT);\r
+ RefModel ticgit = JGitUtils.getTicGitBranch(r);\r
+ assertTrue("Ticgit branch does not exist!", ticgit != null);\r
+ List<TicGitTicket> tickets = JGitUtils.getTicGitTickets(r);\r
+ assertTrue("No tickets found!", tickets.size() > 0);\r
+ r.close();\r
+ }\r
\r
}\r
import java.io.InputStream;\r
import java.io.RandomAccessFile;\r
import java.text.DateFormat;\r
+import java.text.ParseException;\r
import java.text.SimpleDateFormat;\r
import java.util.ArrayList;\r
import java.util.Collections;\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
return getRefs(r, Constants.R_TAGS, maxCount);\r
}\r
\r
- public static List<RefModel> getHeads(Repository r, int maxCount) {\r
+ public static List<RefModel> getLocalBranches(Repository r, int maxCount) {\r
return getRefs(r, Constants.R_HEADS, maxCount);\r
}\r
\r
+ public static List<RefModel> getRemoteBranches(Repository r, int maxCount) {\r
+ return getRefs(r, Constants.R_REMOTES, maxCount);\r
+ }\r
+\r
public static List<RefModel> getRefs(Repository r, String refs, int maxCount) {\r
List<RefModel> list = new ArrayList<RefModel>();\r
try {\r
List<String> keys = new ArrayList<String>(map.keySet());\r
Collections.sort(keys);\r
List<Metric> metrics = new ArrayList<Metric>();\r
- for (String key:keys) {\r
+ for (String key : keys) {\r
metrics.add(map.get(key));\r
- } \r
+ }\r
return metrics;\r
}\r
+\r
+ public static RefModel getTicGitBranch(Repository r) {\r
+ RefModel ticgitBranch = null;\r
+ try {\r
+ // search for ticgit branch in local heads\r
+ for (RefModel ref : getLocalBranches(r, -1)) {\r
+ if (ref.getDisplayName().endsWith("ticgit") || ref.getDisplayName().endsWith("ticgit-ng")) {\r
+ ticgitBranch = ref;\r
+ break;\r
+ }\r
+ }\r
+\r
+ // search for ticgit branch in remote heads\r
+ if (ticgitBranch == null) {\r
+ for (RefModel ref : getRemoteBranches(r, -1)) {\r
+ if (ref.getDisplayName().endsWith("ticgit") || ref.getDisplayName().endsWith("ticgit-ng")) {\r
+ ticgitBranch = ref;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ } catch (Throwable t) {\r
+ LOGGER.error("Failed to find ticgit branch!", t);\r
+ }\r
+ return ticgitBranch;\r
+ }\r
+\r
+ public static List<TicGitTicket> getTicGitTickets(Repository r) {\r
+ RefModel ticgitBranch = getTicGitBranch(r);\r
+ List<PathModel> paths = getFilesInPath(r, null, ticgitBranch.getCommit());\r
+ List<TicGitTicket> tickets = new ArrayList<TicGitTicket>();\r
+ for (PathModel ticketFolder : paths) {\r
+ if (ticketFolder.isTree()) {\r
+ try {\r
+ TicGitTicket t = new TicGitTicket(ticketFolder.name);\r
+ readTicketContents(r, ticgitBranch, t);\r
+ tickets.add(t);\r
+ } catch (Throwable t) {\r
+ LOGGER.error("Failed to get a ticgit ticket!", t);\r
+ }\r
+ }\r
+ }\r
+ Collections.sort(tickets);\r
+ Collections.reverse(tickets);\r
+ return tickets;\r
+ }\r
+\r
+ public static TicGitTicket getTicGitTicket(Repository r, String ticketFolder) {\r
+ RefModel ticgitBranch = getTicGitBranch(r);\r
+ if (ticgitBranch != null) {\r
+ try {\r
+ TicGitTicket ticket = new TicGitTicket(ticketFolder);\r
+ readTicketContents(r, ticgitBranch, ticket);\r
+ return ticket;\r
+ } catch (Throwable t) {\r
+ LOGGER.error("Failed to get ticgit ticket " + ticketFolder, t);\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+ \r
+ private static void readTicketContents(Repository r, RefModel ticgitBranch, TicGitTicket ticket) {\r
+ List<PathModel> ticketFiles = getFilesInPath(r, ticket.name, ticgitBranch.getCommit());\r
+ for (PathModel file : ticketFiles) {\r
+ String content = getRawContentAsString(r, ticgitBranch.getCommit(), file.path).trim();\r
+ if (file.name.equals("TICKET_ID")) {\r
+ ticket.id = content;\r
+ } else if (file.name.equals("TITLE")) {\r
+ ticket.title = content;\r
+ } else {\r
+ String[] chunks = file.name.split("_");\r
+ if (chunks[0].equals("ASSIGNED")) {\r
+ ticket.handler = content;\r
+ } else if (chunks[0].equals("COMMENT")) {\r
+ try {\r
+ Comment c = new Comment(file.name, content);\r
+ ticket.comments.add(c);\r
+ } catch (ParseException e) {\r
+ e.printStackTrace();\r
+ }\r
+ } else if (chunks[0].equals("TAG")) {\r
+ if (content.startsWith("TAG_")) {\r
+ ticket.tags.add(content.substring(4));\r
+ } else {\r
+ ticket.tags.add(content);\r
+ }\r
+ } else if (chunks[0].equals("STATE")) {\r
+ ticket.state = content;\r
+ }\r
+ }\r
+ }\r
+ Collections.sort(ticket.comments);\r
+ }\r
+\r
+ public static String getTicGitContent(Repository r, String filePath) {\r
+ RefModel ticgitBranch = getTicGitBranch(r);\r
+ if (ticgitBranch != null) {\r
+ return getRawContentAsString(r, ticgitBranch.getCommit(), filePath);\r
+ }\r
+ return "";\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
\r
protected String trimShortLog(String string) {\r
- if (string.length() > 60) {\r
- return string.substring(0, 60) + "...";\r
+ return trimString(string, 60);\r
+ }\r
+ \r
+ protected String trimString(String value, int max) {\r
+ if (value.length() <= max) {\r
+ return value;\r
}\r
- return string;\r
+ return value.substring(0, max - 3) + "...";\r
}\r
\r
public void error(String message, Throwable t) {\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.wicket.models.RepositoryModel;\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.HeadsPage;\r
import com.gitblit.wicket.pages.RepositoriesPage;\r
import com.gitblit.wicket.pages.ShortLogPage;\r
import com.gitblit.wicket.pages.SummaryPage;\r
import com.gitblit.wicket.pages.TagPage;\r
import com.gitblit.wicket.pages.TagsPage;\r
+import com.gitblit.wicket.pages.TicGitPage;\r
+import com.gitblit.wicket.pages.TicGitTicketPage;\r
import com.gitblit.wicket.pages.TreePage;\r
\r
\r
// Grab Browser info (like timezone, etc)\r
getRequestCycleSettings().setGatherExtendedBrowserInfo(true);\r
\r
- // setup the url paths\r
+ // setup the standard gitweb-ish urls\r
mount(new MixedParamUrlCodingStrategy("/summary", SummaryPage.class, new String[] { "p" }));\r
mount(new MixedParamUrlCodingStrategy("/shortlog", ShortLogPage.class, new String[] { "p", "h" }));\r
mount(new MixedParamUrlCodingStrategy("/tags", TagsPage.class, new String[] { "p" }));\r
- mount(new MixedParamUrlCodingStrategy("/heads", HeadsPage.class, new String[] { "p" }));\r
+ mount(new MixedParamUrlCodingStrategy("/branches", BranchesPage.class, new String[] { "p" }));\r
mount(new MixedParamUrlCodingStrategy("/commit", CommitPage.class, new String[] { "p", "h" }));\r
mount(new MixedParamUrlCodingStrategy("/tag", TagPage.class, new String[] { "p", "h" }));\r
mount(new MixedParamUrlCodingStrategy("/tree", TreePage.class, new String[] { "p", "h", "f" }));\r
mount(new MixedParamUrlCodingStrategy("/blob", BlobPage.class, new String[] { "p", "h", "f" }));\r
\r
+ // setup extended urls\r
+ mount(new MixedParamUrlCodingStrategy("/ticgit", TicGitPage.class, new String[] { "p" }));\r
+ mount(new MixedParamUrlCodingStrategy("/ticgittkt", TicGitTicketPage.class, new String[] { "p", "f" }));\r
+ \r
repositories = new File(StoredSettings.getString("repositoriesFolder", "repos"));\r
exportAll = StoredSettings.getBoolean("exportAll", true);\r
repositoryResolver = new FileResolver(repositories, exportAll);\r
return newCommitParameter();\r
}\r
return new PageParameters("p=" + repositoryName + ",h=" + commitId + ",f=" + path);\r
- }\r
+ } \r
}\r
public String getName() {\r
return ref.getName();\r
}\r
+ \r
+ public RevCommit getCommit() {\r
+ return commit;\r
+ }\r
\r
public ObjectId getCommitId() {\r
return commit.getId();\r
public ObjectId getObjectId() {\r
return ref.getObjectId();\r
}\r
-\r
+ \r
+ public boolean isAnnotatedTag() {\r
+ return ref.isPeeled();\r
+ }\r
+ \r
@Override\r
public int compareTo(RefModel o) {\r
return getDate().compareTo(o.getDate());\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<html xmlns="http://www.w3.org/1999/xhtml" >\r
+<body>\r
+ <!-- page header -->\r
+ <div wicket:id="pageHeader"></div>\r
+\r
+ <!-- page nav links --> \r
+ <div wicket:id="pageLinks"></div>\r
+ \r
+ <!-- shortlog --> \r
+ <div style="margin-top:5px;" class="header" wicket:id="summary"></div> \r
+ <table class="pretty">\r
+ <tbody>\r
+ <tr wicket:id="branch">\r
+ <td><i><span wicket:id="branchDate"></span></i></td>\r
+ <td><div wicket:id="branchName"></div></td>\r
+ <td><div wicket:id="branchType"></div></td>\r
+ <td class="rightAlign"><span wicket:id="branchLinks"></span></td>\r
+ </tr>\r
+ </tbody>\r
+ </table> \r
+ \r
+ <!-- footer -->\r
+ <div wicket:id="pageFooter"></div>\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.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
+\r
+import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.utils.Utils;\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
+import com.gitblit.wicket.panels.BranchLinksPanel;\r
+\r
+\r
+public class BranchesPage extends RepositoryPage {\r
+\r
+ public BranchesPage(PageParameters params) {\r
+ super(params, "branches");\r
+\r
+ Repository r = getRepository();\r
+ List<RefModel> branches = new ArrayList<RefModel>();\r
+ branches.addAll(JGitUtils.getLocalBranches(r, -1));\r
+ branches.addAll(JGitUtils.getRemoteBranches(r, -1));\r
+ r.close();\r
+\r
+ // shortlog\r
+ add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));\r
+\r
+ ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);\r
+ DataView<RefModel> branchView = new DataView<RefModel>("branch", branchesDp) {\r
+ private static final long serialVersionUID = 1L;\r
+ int counter = 0;\r
+\r
+ public void populateItem(final Item<RefModel> item) {\r
+ final RefModel entry = item.getModelObject();\r
+ String date;\r
+ if (entry.getDate() != null) {\r
+ date = Utils.timeAgo(entry.getDate());\r
+ } else {\r
+ date = "";\r
+ }\r
+ Label branchDateLabel = new Label("branchDate", date);\r
+ item.add(branchDateLabel);\r
+ WicketUtils.setCssClass(branchDateLabel, Utils.timeAgoCss(entry.getDate()));\r
+\r
+ item.add(new LinkPanel("branchName", "list name", entry.getDisplayName(), ShortLogPage.class, newCommitParameter(entry.getName())));\r
+\r
+ boolean remote = entry.getName().startsWith(Constants.R_REMOTES);\r
+ item.add(new Label("branchType", remote ? "remote":"local"));\r
+ \r
+ item.add(new BranchLinksPanel("branchLinks", repositoryName, entry));\r
+ \r
+ String clazz = counter % 2 == 0 ? "dark" : "light";\r
+ WicketUtils.setCssClass(item, clazz);\r
+ counter++;\r
+ }\r
+ };\r
+ add(branchView);\r
+\r
+ // footer\r
+ addFooter();\r
+ }\r
+}\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<html xmlns="http://www.w3.org/1999/xhtml" >\r
-<body>\r
- <!-- page header -->\r
- <div wicket:id="pageHeader"></div>\r
-\r
- <!-- page nav links --> \r
- <div wicket:id="pageLinks"></div>\r
- \r
- <!-- shortlog --> \r
- <div class="header" wicket:id="summary"></div> \r
- <table>\r
- <tbody>\r
- <tr wicket:id="head">\r
- <td><i><span wicket:id="headDate"></span></i></td>\r
- <td><div wicket:id="headName"></div></td>\r
- <td></td>\r
- </tr>\r
- </tbody>\r
- </table> \r
- \r
- <!-- footer -->\r
- <div wicket:id="pageFooter"></div>\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-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.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
-\r
-import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.utils.Utils;\r
-import com.gitblit.wicket.GitBlitWebApp;\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 HeadsPage extends RepositoryPage {\r
-\r
- public HeadsPage(PageParameters params) {\r
- super(params, "heads");\r
-\r
- Repository r = getRepository();\r
- List<RefModel> tags = JGitUtils.getHeads(r, -1);\r
- r.close();\r
-\r
- // shortlog\r
- add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));\r
-\r
- ListDataProvider<RefModel> tagsDp = new ListDataProvider<RefModel>(tags);\r
- DataView<RefModel> tagView = new DataView<RefModel>("head", tagsDp) {\r
- private static final long serialVersionUID = 1L;\r
- int counter = 0;\r
-\r
- public void populateItem(final Item<RefModel> item) {\r
- final RefModel entry = item.getModelObject();\r
- String date;\r
- if (entry.getDate() != null) {\r
- date = Utils.timeAgo(entry.getDate());\r
- } else {\r
- date = "";\r
- }\r
- Label headDateLabel = new Label("headDate", date);\r
- item.add(headDateLabel);\r
- WicketUtils.setCssClass(headDateLabel, Utils.timeAgoCss(entry.getDate()));\r
-\r
- item.add(new LinkPanel("headName", "list name", entry.getDisplayName(), ShortLogPage.class, newCommitParameter(entry.getName())));\r
-\r
- String clazz = counter % 2 == 0 ? "dark" : "light";\r
- WicketUtils.setCssClass(item, clazz);\r
- counter++;\r
- }\r
- };\r
- tagView.setItemsPerPage(GitBlitWebApp.PAGING_ITEM_COUNT);\r
- add(tagView);\r
-\r
- // footer\r
- addFooter();\r
- }\r
-}\r
</table> \r
<div class="pager" wicket:id="shortlogMore"></div>\r
\r
- <!-- Open Heads Body -->\r
- <div style="width:300px;float:right;">\r
+ <!-- Open Branches Body -->\r
+ <div style="width:400px; float:left;">\r
<!-- heads -->\r
- <div class="header" wicket:id="heads"></div> \r
+ <div class="header" wicket:id="branches"></div> \r
<table style="width:100%" class="pretty">\r
<tbody>\r
- <tr wicket:id="head">\r
- <td class="date"><span wicket:id="headDate"></span></td>\r
- <td><div wicket:id="headName"></div></td>\r
- <td class="rightAlign"><span wicket:id="headLinks"></span></td>\r
+ <tr wicket:id="branch">\r
+ <td class="date"><span wicket:id="branchDate"></span></td>\r
+ <td><div wicket:id="branchName"></div></td>\r
+ <td class="rightAlign"><span wicket:id="branchLinks"></span></td>\r
</tr>\r
</tbody>\r
</table>\r
- <div class="pager" wicket:id="allHeads"></div>\r
- <!-- Close Heads Body -->\r
+ <div class="pager" wicket:id="allBranches"></div>\r
+ <!-- Close Branches Body -->\r
</div>\r
- \r
+\r
<!-- Open Tags body -->\r
- <div style="margin-right:305px;">\r
+ <div style="margin-left:405px;">\r
<!-- tags -->\r
<div class="header" wicket:id="tags"></div> \r
<table style="width:100%" class="pretty">\r
package com.gitblit.wicket.pages;\r
\r
import java.awt.Dimension;\r
+import java.util.ArrayList;\r
+import java.util.Collections;\r
import java.util.Date;\r
import java.util.List;\r
import java.util.Map;\r
import com.gitblit.wicket.models.Metric;\r
import com.gitblit.wicket.models.RefModel;\r
import com.gitblit.wicket.panels.AnnotatedTagLinksPanel;\r
-import com.gitblit.wicket.panels.HeadLinksPanel;\r
+import com.gitblit.wicket.panels.BranchLinksPanel;\r
import com.gitblit.wicket.panels.RefsPanel;\r
import com.gitblit.wicket.panels.ShortLogLinksPanel;\r
import com.gitblit.wicket.panels.TagLinksPanel;\r
\r
item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, newCommitParameter(entry.getCommitId().getName())));\r
\r
- if (entry.getCommitId().equals(entry.getObjectId())) {\r
- // simple tag\r
- item.add(new Label("tagDescription", ""));\r
- item.add(new TagLinksPanel("tagLinks", repositoryName, entry));\r
- } else {\r
+ if (entry.isAnnotatedTag()) {\r
// annotated tag\r
item.add(new LinkPanel("tagDescription", "list subject", entry.getShortLog(), TagPage.class, newCommitParameter(entry.getObjectId().getName())));\r
item.add(new AnnotatedTagLinksPanel("tagLinks", repositoryName, entry));\r
+ } else {\r
+ // simple tag on commit object\r
+ item.add(new Label("tagDescription", ""));\r
+ item.add(new TagLinksPanel("tagLinks", repositoryName, entry));\r
}\r
\r
setAlternatingBackground(item, counter);\r
add(new LinkPanel("allTags", "link", "all tags...", TagsPage.class, newRepositoryParameter()));\r
}\r
\r
- // heads\r
- List<RefModel> heads = JGitUtils.getHeads(r, numberRefs);\r
- add(new LinkPanel("heads", "title", "heads", HeadsPage.class, newRepositoryParameter()));\r
+ // branches\r
+ List<RefModel> branches = new ArrayList<RefModel>();\r
+ branches.addAll(JGitUtils.getLocalBranches(r, numberRefs));\r
+ branches.addAll(JGitUtils.getRemoteBranches(r, numberRefs));\r
+ Collections.sort(branches);\r
+ Collections.reverse(branches);\r
+ if (numberRefs > 0 && branches.size() > numberRefs) {\r
+ branches = new ArrayList<RefModel>(branches.subList(0, numberRefs));\r
+ }\r
+\r
+ add(new LinkPanel("branches", "title", "branches", BranchesPage.class, newRepositoryParameter()));\r
\r
- ListDataProvider<RefModel> headsDp = new ListDataProvider<RefModel>(heads);\r
- DataView<RefModel> headsView = new DataView<RefModel>("head", headsDp) {\r
+ ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);\r
+ DataView<RefModel> branchesView = new DataView<RefModel>("branch", branchesDp) {\r
private static final long serialVersionUID = 1L;\r
int counter = 0;\r
\r
public void populateItem(final Item<RefModel> item) {\r
final RefModel entry = item.getModelObject();\r
\r
- item.add(createDateLabel("headDate", entry.getDate()));\r
+ item.add(createDateLabel("branchDate", entry.getDate()));\r
\r
- item.add(new LinkPanel("headName", "list name", entry.getDisplayName(), ShortLogPage.class, newCommitParameter(entry.getName())));\r
+ item.add(new LinkPanel("branchName", "list name", trimString(entry.getDisplayName(), 28), ShortLogPage.class, newCommitParameter(entry.getName())));\r
\r
- item.add(new HeadLinksPanel("headLinks", repositoryName, entry));\r
+ item.add(new BranchLinksPanel("branchLinks", repositoryName, entry));\r
\r
setAlternatingBackground(item, counter);\r
counter++;\r
}\r
};\r
- add(headsView);\r
- if (heads.size() < numberRefs) {\r
- add(new Label("allHeads", "").setVisible(false));\r
+ add(branchesView);\r
+ if (branches.size() < numberRefs) {\r
+ add(new Label("allBranches", "").setVisible(false));\r
} else {\r
- add(new LinkPanel("allHeads", "link", "all heads...", HeadsPage.class, newRepositoryParameter()));\r
+ add(new LinkPanel("allBranches", "link", "all branches...", BranchesPage.class, newRepositoryParameter()));\r
}\r
\r
// Display an activity line graph\r
\r
item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, newCommitParameter(entry.getObjectId().getName())));\r
\r
- if (entry.getCommitId().equals(entry.getObjectId())) {\r
- // simple tag on commit object\r
- item.add(new Label("tagDescription", ""));\r
- item.add(new TagLinksPanel("tagLinks", repositoryName, entry));\r
- } else {\r
+ if (entry.isAnnotatedTag()) {\r
// annotated tag\r
item.add(new LinkPanel("tagDescription", "list subject", entry.getShortLog(), TagPage.class, newCommitParameter(entry.getObjectId().getName())));\r
item.add(new AnnotatedTagLinksPanel("tagLinks", repositoryName, entry));\r
+ } else {\r
+ // simple tag on commit object\r
+ item.add(new Label("tagDescription", ""));\r
+ item.add(new TagLinksPanel("tagLinks", repositoryName, entry));\r
}\r
\r
setAlternatingBackground(item, counter);\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<html xmlns="http://www.w3.org/1999/xhtml" >\r
+<body>\r
+ <!-- page header -->\r
+ <div wicket:id="pageHeader"></div>\r
+\r
+ <!-- page nav links --> \r
+ <div wicket:id="pageLinks"></div>\r
+\r
+ <!-- shortlog --> \r
+ <div style="margin-top:5px;" class="header" wicket:id="summary"></div> \r
+ <table style="width:100%" class="pretty">\r
+ <tbody>\r
+ <tr wicket:id="ticket">\r
+ <td style="padding:0; margin:0;" ><div wicket:id="ticketState"></div></td>\r
+ <td class="date"><span wicket:id="ticketDate"></span></td>\r
+ <td><div wicket:id="ticketHandler"></div></td>\r
+ <td><div wicket:id="ticketTitle"></div></td>\r
+ </tr>\r
+ </tbody>\r
+ </table> \r
+ \r
+ <!-- footer -->\r
+ <div wicket:id="pageFooter"></div>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+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.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
+\r
+import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.utils.TicGitTicket;\r
+import com.gitblit.wicket.LinkPanel;\r
+import com.gitblit.wicket.RepositoryPage;\r
+import com.gitblit.wicket.WicketUtils;\r
+\r
+public class TicGitPage extends RepositoryPage {\r
+\r
+ public TicGitPage(PageParameters params) {\r
+ super(params, "ticgit");\r
+\r
+ Repository r = getRepository();\r
+ List<TicGitTicket> tickets = JGitUtils.getTicGitTickets(r);\r
+ r.close();\r
+\r
+ // shortlog\r
+ add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));\r
+\r
+ ListDataProvider<TicGitTicket> ticketsDp = new ListDataProvider<TicGitTicket>(tickets);\r
+ DataView<TicGitTicket> ticketsView = new DataView<TicGitTicket>("ticket", ticketsDp) {\r
+ private static final long serialVersionUID = 1L;\r
+ int counter = 0;\r
+\r
+ public void populateItem(final Item<TicGitTicket> item) {\r
+ final TicGitTicket entry = item.getModelObject();\r
+ Label stateLabel = new Label("ticketState", entry.state);\r
+ String css = null;\r
+ if (entry.state.equals("open")) {\r
+ css = "bug_open";\r
+ } else if (entry.state.equals("hold")) {\r
+ css = "bug_hold";\r
+ } else if (entry.state.equals("resolved")) {\r
+ css = "bug_resolved";\r
+ } else if (entry.state.equals("invalid")) {\r
+ css = "bug_invalid";\r
+ }\r
+ if (css != null) {\r
+ WicketUtils.setCssClass(stateLabel, css);\r
+ }\r
+ item.add(stateLabel);\r
+ item.add(createDateLabel("ticketDate", entry.date));\r
+ item.add(new Label("ticketHandler", trimString(entry.handler, 30)));\r
+ item.add(new LinkPanel("ticketTitle", null, trimString(entry.title, 80), TicGitTicketPage.class, newPathParameter(entry.name)));\r
+\r
+ setAlternatingBackground(item, counter);\r
+ counter++;\r
+ }\r
+ };\r
+ add(ticketsView);\r
+\r
+ // footer\r
+ addFooter();\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<html xmlns="http://www.w3.org/1999/xhtml" >\r
+<body>\r
+ <!-- page header -->\r
+ <div wicket:id="pageHeader"></div>\r
+\r
+ <!-- page nav links --> \r
+ <div wicket:id="pageLinks"></div>\r
+ \r
+ <!-- ticket title -->\r
+ <div style="font-size:150%;padding-top:5px;" wicket:id="ticketTitle"></div>\r
+ \r
+ <!-- ticket info -->\r
+ <table class="plain">\r
+ <tr><th>ticket id</th><td class="sha1"><span wicket:id="ticketId">Message goes here</span></td></tr>\r
+ <tr><th>assigned</th><td><span wicket:id=ticketHandler>Message goes here</span></td></tr>\r
+ <tr><th>open date</th><td><span wicket:id="ticketOpenDate">Message goes here</span></td></tr>\r
+ <tr><th>state</th><td><span wicket:id="ticketState">Message goes here</span></td></tr>\r
+ <tr><th>tags</th><td><span wicket:id="ticketTags">Message goes here</span></td></tr>\r
+ </table>\r
+ \r
+ <!-- comments header -->\r
+ <div class="header">Comments</div>\r
+ \r
+ <!-- comments -->\r
+ <table style="width:100%;" class="pretty">\r
+ <tbody>\r
+ <tr wicket:id="comment">\r
+ <td class="date"><span wicket:id="commentDate"></span></td>\r
+ <td><b><div wicket:id="commentAuthor"></div></b></td>\r
+ <td><div wicket:id="commentText"></div></td>\r
+ </tr>\r
+ </tbody>\r
+ </table>\r
+ \r
+ <!-- footer -->\r
+ <div wicket:id="pageFooter"></div>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+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.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
+\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
+\r
+public class TicGitTicketPage extends RepositoryPage {\r
+\r
+ public TicGitTicketPage(PageParameters params) {\r
+ super(params, "ticgit ticket");\r
+\r
+ final String ticketFolder = params.getString("f", "");\r
+\r
+ Repository r = getRepository();\r
+ TicGitTicket t = JGitUtils.getTicGitTicket(r, ticketFolder);\r
+ r.close();\r
+\r
+ add(new Label("ticketTitle", t.title));\r
+ add(new Label("ticketId", t.id));\r
+ add(new Label("ticketHandler", t.handler));\r
+ String openDate = GitBlitWebSession.get().formatDateTimeLong(t.date);\r
+ add(new Label("ticketOpenDate", openDate));\r
+ add(new Label("ticketState", t.state));\r
+ add(new Label("ticketTags", flattenStrings(t.tags)));\r
+\r
+ ListDataProvider<Comment> commentsDp = new ListDataProvider<Comment>(t.comments);\r
+ DataView<Comment> commentsView = new DataView<Comment>("comment", commentsDp) {\r
+ private static final long serialVersionUID = 1L;\r
+ int counter = 0;\r
+\r
+ public void populateItem(final Item<Comment> item) {\r
+ final Comment entry = item.getModelObject();\r
+ item.add(createDateLabel("commentDate", entry.date));\r
+ item.add(new Label("commentAuthor", entry.author));\r
+ item.add(new Label("commentText", prepareComment(entry.text)).setEscapeModelStrings(false));\r
+ setAlternatingBackground(item, counter);\r
+ counter++;\r
+ }\r
+ };\r
+ add(commentsView);\r
+\r
+ // footer\r
+ addFooter();\r
+ }\r
+\r
+ private String prepareComment(String comment) {\r
+ String html = WicketUtils.breakLines(comment).trim();\r
+ return html.replaceAll("\\bcommit\\s*([A-Za-z0-9]*)\\b", "<a href=\"/commit/" + repositoryName + "/$1\">commit $1</a>");\r
+ }\r
+\r
+ private String flattenStrings(List<String> values) {\r
+ StringBuilder sb = new StringBuilder();\r
+ for (String value : values) {\r
+ sb.append(value).append(" ");\r
+ }\r
+ return sb.toString().trim();\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">\r
+<wicket:panel>\r
+ <div class="link">\r
+ <span wicket:id="shortlog"></span> | <span wicket:id="tree"></span>\r
+ </div> \r
+</wicket:panel>\r
+</html>
\ No newline at end of file
--- /dev/null
+package com.gitblit.wicket.panels;\r
+\r
+import org.apache.wicket.PageParameters;\r
+import org.apache.wicket.markup.html.panel.Panel;\r
+\r
+import com.gitblit.wicket.LinkPanel;\r
+import com.gitblit.wicket.models.RefModel;\r
+import com.gitblit.wicket.pages.ShortLogPage;\r
+import com.gitblit.wicket.pages.TreePage;\r
+\r
+\r
+public class BranchLinksPanel extends Panel {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public BranchLinksPanel(String id, String repositoryName, RefModel tag) {\r
+ super(id);\r
+ add(new LinkPanel("shortlog", null, "shortlog", ShortLogPage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getName())));\r
+ add(new LinkPanel("tree", null, "tree", TreePage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getName())));\r
+ }\r
+}
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">\r
-<wicket:panel>\r
- <div class="link">\r
- <span wicket:id="shortlog"></span> | <span wicket:id="tree"></span>\r
- </div> \r
-</wicket:panel>\r
-</html>
\ No newline at end of file
+++ /dev/null
-package com.gitblit.wicket.panels;\r
-\r
-import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.basic.Label;\r
-import org.apache.wicket.markup.html.panel.Panel;\r
-\r
-import com.gitblit.wicket.LinkPanel;\r
-import com.gitblit.wicket.models.RefModel;\r
-import com.gitblit.wicket.pages.ShortLogPage;\r
-\r
-\r
-public class HeadLinksPanel extends Panel {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public HeadLinksPanel(String id, String repositoryName, RefModel tag) {\r
- super(id);\r
- add(new LinkPanel("shortlog", null, "shortlog", ShortLogPage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getName())));\r
- add(new Label("tree", "tree"));\r
- }\r
-}
\ No newline at end of file
<wicket:panel>\r
<!-- page nav links --> \r
<div class="page_nav">\r
- <span wicket:id="summary"></span> | <span wicket:id="shortlog"></span> | <span wicket:id="tags"></span> | <span wicket:id="commit"></span> | <span wicket:id="commitdiff"></span> | <span wicket:id="tree"></span>\r
+ <span wicket:id="summary"></span> | <span wicket:id="shortlog"></span> | <span wicket:id="branches"></span> | <span wicket:id="tags"></span> | <span wicket:id="tree"></span>\r
</div> \r
</wicket:panel>\r
</html>
\ No newline at end of file
import org.apache.wicket.markup.html.panel.Panel;\r
\r
import com.gitblit.wicket.LinkPanel;\r
+import com.gitblit.wicket.pages.BranchesPage;\r
import com.gitblit.wicket.pages.CommitPage;\r
import com.gitblit.wicket.pages.ShortLogPage;\r
import com.gitblit.wicket.pages.SummaryPage;\r
add(new LinkPanel("shortlog", null, "shortlog", ShortLogPage.class, new PageParameters("p=" + repositoryName)));\r
}\r
\r
+ // branches\r
+ if (pageName.equals("branches")) {\r
+ add(new Label("branches", pageName));\r
+ } else {\r
+ add(new LinkPanel("branches", null, "branches", BranchesPage.class, new PageParameters("p=" + repositoryName)));\r
+ }\r
+ \r
// tags\r
if (pageName.equals("tags")) {\r
add(new Label("tags", pageName));\r
} else {\r
add(new LinkPanel("tags", null, "tags", TagsPage.class, new PageParameters("p=" + repositoryName)));\r
}\r
-\r
- // commit\r
- if (pageName.equals("commit")) {\r
- add(new Label("commit", pageName));\r
- } else {\r
- add(new LinkPanel("commit", null, "commit", CommitPage.class, new PageParameters("p=" + repositoryName + ",h=HEAD")));\r
- }\r
- // commitdiff\r
- if (pageName.equals("commitdiff")) {\r
- add(new Label("commitdiff", pageName));\r
- } else {\r
- add(new Label("commitdiff", "commitdiff"));\r
- }\r
+ \r
// tree\r
if (pageName.equals("tree")) {\r
add(new Label("tree", pageName));\r