From f76fee63ed9cb3a30d3c0c092d860b1cb93a481b Mon Sep 17 00:00:00 2001
From: Gerard Smyth <gerard.smyth@gmail.com>
Date: Thu, 08 May 2014 13:09:30 -0400
Subject: [PATCH] Updated the SyndicationServlet to provide an additional option to return details of the tags in the repository instead of the commits. This uses a new 'ot' request parameter to indicate the object type of the content to return, which can be ither TAG or COMMIT. If this is not provided, then COMMIT is assumed to maintain backwards compatability. If tags are returned, then the paging parameters, 'l' and 'pg' are still supported, but searching options are currently ignored.
---
src/main/java/com/gitblit/wicket/panels/RefsPanel.java | 33 ++++++++++++++++++++++++++-------
1 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/gitblit/wicket/panels/RefsPanel.java b/src/main/java/com/gitblit/wicket/panels/RefsPanel.java
index 7a16f4a..8d21086 100644
--- a/src/main/java/com/gitblit/wicket/panels/RefsPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/RefsPanel.java
@@ -25,7 +25,6 @@
import org.apache.wicket.Component;
import org.apache.wicket.markup.html.WebPage;
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;
@@ -34,13 +33,15 @@
import com.gitblit.Constants;
import com.gitblit.models.RefModel;
+import com.gitblit.models.RepositoryModel;
import com.gitblit.utils.StringUtils;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.pages.CommitPage;
import com.gitblit.wicket.pages.LogPage;
import com.gitblit.wicket.pages.TagPage;
+import com.gitblit.wicket.pages.TicketsPage;
-public class RefsPanel extends Panel {
+public class RefsPanel extends BasePanel {
private static final long serialVersionUID = 1L;
@@ -88,6 +89,8 @@
}
}
final boolean shouldBreak = remoteCount < refs.size();
+ RepositoryModel repository = app().repositories().getRepositoryModel(repositoryName);
+ final boolean hasTickets = app().tickets().hasTickets(repository);
ListDataProvider<RefModel> refsDp = new ListDataProvider<RefModel>(refs);
DataView<RefModel> refsView = new DataView<RefModel>("ref", refsDp) {
@@ -103,7 +106,13 @@
Class<? extends WebPage> linkClass = CommitPage.class;
String cssClass = "";
String tooltip = "";
- if (name.startsWith(Constants.R_HEADS)) {
+ if (name.startsWith(Constants.R_TICKET)) {
+ // Gitblit ticket ref
+ objectid = name.substring(Constants.R_TICKET.length());
+ name = name.substring(Constants.R_HEADS.length());
+ linkClass = TicketsPage.class;
+ cssClass = "localBranch";
+ } else if (name.startsWith(Constants.R_HEADS)) {
// local branch
linkClass = LogPage.class;
name = name.substring(Constants.R_HEADS.length());
@@ -113,12 +122,22 @@
linkClass = LogPage.class;
cssClass = "headRef";
} else if (name.startsWith(Constants.R_CHANGES)) {
- // Gerrit change ref
+ // Gitblit change ref
name = name.substring(Constants.R_CHANGES.length());
// strip leading nn/ from nn/#####nn/ps = #####nn-ps
name = name.substring(name.indexOf('/') + 1).replace('/', '-');
String [] values = name.split("-");
+ // Gerrit change
tooltip = MessageFormat.format(getString("gb.reviewPatchset"), values[0], values[1]);
+ cssClass = "otherRef";
+ } else if (name.startsWith(Constants.R_TICKETS_PATCHSETS)) {
+ // Gitblit patchset ref
+ name = name.substring(Constants.R_TICKETS_PATCHSETS.length());
+ // strip leading nn/ from nn/#####nn/ps = #####nn-ps
+ name = name.substring(name.indexOf('/') + 1).replace('/', '-');
+ String [] values = name.split("-");
+ tooltip = MessageFormat.format(getString("gb.ticketPatchset"), values[0], values[1]);
+ linkClass = LogPage.class;
cssClass = "otherRef";
} else if (name.startsWith(Constants.R_PULL)) {
// Pull Request ref
@@ -154,11 +173,11 @@
// codereview refs
linkClass = CommitPage.class;
cssClass = "otherRef";
- } else if (name.startsWith(com.gitblit.Constants.R_GITBLIT)) {
- // gitblit refs
+ } else if (name.startsWith(com.gitblit.Constants.R_META)) {
+ // internal meta refs
linkClass = LogPage.class;
cssClass = "otherRef";
- name = name.substring(com.gitblit.Constants.R_GITBLIT.length());
+ name = name.substring(com.gitblit.Constants.R_META.length());
}
Component c = new LinkPanel("refName", null, name, linkClass,
--
Gitblit v1.9.1