From 9802a766a28bfcb0ae01494ebfa1cbeb11e71809 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sun, 17 Apr 2011 12:06:29 -0400
Subject: [PATCH] Rename ticgit integration to tickets.
---
src/com/gitblit/wicket/models/TicketModel.java | 8 +-
src/com/gitblit/wicket/pages/TicketPage.java | 10 +-
gitblit.properties | 8 +-
src/com/gitblit/wicket/GitBlitWebApp.properties | 2
src/com/gitblit/wicket/panels/HistoryPanel.java | 1
src/com/gitblit/wicket/panels/PageLinksPanel.java | 18 +++---
src/com/gitblit/wicket/pages/TicketsPage.html | 0
src/com/gitblit/wicket/GitBlitWebApp.java | 10 +-
src/com/gitblit/tests/JGitUtilsTest.java | 6 +-
src/com/gitblit/wicket/pages/TicketPage.html | 0
src/com/gitblit/utils/JGitUtils.java | 46 +++++++-------
src/com/gitblit/wicket/pages/TicketsPage.java | 20 +++---
12 files changed, 65 insertions(+), 64 deletions(-)
diff --git a/gitblit.properties b/gitblit.properties
index a482810..93183eb 100644
--- a/gitblit.properties
+++ b/gitblit.properties
@@ -103,11 +103,11 @@
# Example per-repository regex substitutions overrides global
#regex.myrepository.bug = \\b(Bug:)(\\s*[#]?|-){0,1}(\\d+)\\b!!!<a href="http://elsewhere/bug/$3">Bug-Id: $3</a>
-# Enable ticgit pages for all repositories (if ticgit branch is present)
-ticgit.global = false
+# Enable tickets pages for all repositories (if ticgit branch is present)
+tickets.global = false
-# Enable ticgit pages for specified repository (if ticgit branch is present)
-#ticgit.myrepository = true
+# Enable tickets pages for specified repository (if ticgit branch is present)
+#tickets.myrepository = true
#
# Server Settings
diff --git a/src/com/gitblit/tests/JGitUtilsTest.java b/src/com/gitblit/tests/JGitUtilsTest.java
index c77aaaf..b6b497f 100644
--- a/src/com/gitblit/tests/JGitUtilsTest.java
+++ b/src/com/gitblit/tests/JGitUtilsTest.java
@@ -17,7 +17,7 @@
import com.gitblit.utils.JGitUtils;
import com.gitblit.wicket.models.PathModel;
import com.gitblit.wicket.models.RefModel;
-import com.gitblit.wicket.models.TicGitTicket;
+import com.gitblit.wicket.models.TicketModel;
public class JGitUtilsTest extends TestCase {
@@ -72,9 +72,9 @@
public void testTicGit() throws Exception {
Repository r = new FileRepository(new File(repositoriesFolder, "ticgit") + "/" + Constants.DOT_GIT);
- RefModel ticgit = JGitUtils.getTicGitBranch(r);
+ RefModel ticgit = JGitUtils.getTicketsBranch(r);
assertTrue("Ticgit branch does not exist!", ticgit != null);
- List<TicGitTicket> tickets = JGitUtils.getTicGitTickets(r);
+ List<TicketModel> tickets = JGitUtils.getTickets(r);
assertTrue("No tickets found!", tickets.size() > 0);
r.close();
}
diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java
index 7128f72..075ad81 100644
--- a/src/com/gitblit/utils/JGitUtils.java
+++ b/src/com/gitblit/utils/JGitUtils.java
@@ -46,8 +46,8 @@
import com.gitblit.wicket.models.Metric;
import com.gitblit.wicket.models.PathModel;
import com.gitblit.wicket.models.RefModel;
-import com.gitblit.wicket.models.TicGitTicket;
-import com.gitblit.wicket.models.TicGitTicket.Comment;
+import com.gitblit.wicket.models.TicketModel;
+import com.gitblit.wicket.models.TicketModel.Comment;
public class JGitUtils {
@@ -614,12 +614,12 @@
return metrics;
}
- public static RefModel getTicGitBranch(Repository r) {
+ public static RefModel getTicketsBranch(Repository r) {
RefModel ticgitBranch = null;
try {
// search for ticgit branch in local heads
for (RefModel ref : getLocalBranches(r, -1)) {
- if (ref.getDisplayName().endsWith("ticgit") || ref.getDisplayName().endsWith("ticgit-ng")) {
+ if (ref.getDisplayName().endsWith("ticgit")) {
ticgitBranch = ref;
break;
}
@@ -628,7 +628,7 @@
// search for ticgit branch in remote heads
if (ticgitBranch == null) {
for (RefModel ref : getRemoteBranches(r, -1)) {
- if (ref.getDisplayName().endsWith("ticgit") || ref.getDisplayName().endsWith("ticgit-ng")) {
+ if (ref.getDisplayName().endsWith("ticgit")) {
ticgitBranch = ref;
break;
}
@@ -640,18 +640,18 @@
return ticgitBranch;
}
- public static List<TicGitTicket> getTicGitTickets(Repository r) {
- RefModel ticgitBranch = getTicGitBranch(r);
+ public static List<TicketModel> getTickets(Repository r) {
+ RefModel ticgitBranch = getTicketsBranch(r);
List<PathModel> paths = getFilesInPath(r, null, ticgitBranch.getCommit());
- List<TicGitTicket> tickets = new ArrayList<TicGitTicket>();
+ List<TicketModel> tickets = new ArrayList<TicketModel>();
for (PathModel ticketFolder : paths) {
if (ticketFolder.isTree()) {
try {
- TicGitTicket t = new TicGitTicket(ticketFolder.name);
+ TicketModel t = new TicketModel(ticketFolder.name);
readTicketContents(r, ticgitBranch, t);
tickets.add(t);
} catch (Throwable t) {
- LOGGER.error("Failed to get a ticgit ticket!", t);
+ LOGGER.error("Failed to get a ticket!", t);
}
}
}
@@ -660,24 +660,24 @@
return tickets;
}
- public static TicGitTicket getTicGitTicket(Repository r, String ticketFolder) {
- RefModel ticgitBranch = getTicGitBranch(r);
- if (ticgitBranch != null) {
+ public static TicketModel getTicket(Repository r, String ticketFolder) {
+ RefModel ticketsBranch = getTicketsBranch(r);
+ if (ticketsBranch != null) {
try {
- TicGitTicket ticket = new TicGitTicket(ticketFolder);
- readTicketContents(r, ticgitBranch, ticket);
+ TicketModel ticket = new TicketModel(ticketFolder);
+ readTicketContents(r, ticketsBranch, ticket);
return ticket;
} catch (Throwable t) {
- LOGGER.error("Failed to get ticgit ticket " + ticketFolder, t);
+ LOGGER.error("Failed to get ticket " + ticketFolder, t);
}
}
return null;
}
- private static void readTicketContents(Repository r, RefModel ticgitBranch, TicGitTicket ticket) {
- List<PathModel> ticketFiles = getFilesInPath(r, ticket.name, ticgitBranch.getCommit());
+ private static void readTicketContents(Repository r, RefModel ticketsBranch, TicketModel ticket) {
+ List<PathModel> ticketFiles = getFilesInPath(r, ticket.name, ticketsBranch.getCommit());
for (PathModel file : ticketFiles) {
- String content = getRawContentAsString(r, ticgitBranch.getCommit(), file.path).trim();
+ String content = getRawContentAsString(r, ticketsBranch.getCommit(), file.path).trim();
if (file.name.equals("TICKET_ID")) {
ticket.id = content;
} else if (file.name.equals("TITLE")) {
@@ -707,10 +707,10 @@
Collections.sort(ticket.comments);
}
- public static String getTicGitContent(Repository r, String filePath) {
- RefModel ticgitBranch = getTicGitBranch(r);
- if (ticgitBranch != null) {
- return getRawContentAsString(r, ticgitBranch.getCommit(), filePath);
+ public static String getTicketContent(Repository r, String filePath) {
+ RefModel ticketsBranch = getTicketsBranch(r);
+ if (ticketsBranch != null) {
+ return getRawContentAsString(r, ticketsBranch.getCommit(), filePath);
}
return "";
}
diff --git a/src/com/gitblit/wicket/GitBlitWebApp.java b/src/com/gitblit/wicket/GitBlitWebApp.java
index 28f6262..74057c9 100644
--- a/src/com/gitblit/wicket/GitBlitWebApp.java
+++ b/src/com/gitblit/wicket/GitBlitWebApp.java
@@ -25,8 +25,8 @@
import com.gitblit.wicket.pages.SummaryPage;
import com.gitblit.wicket.pages.TagPage;
import com.gitblit.wicket.pages.TagsPage;
-import com.gitblit.wicket.pages.TicGitPage;
-import com.gitblit.wicket.pages.TicGitTicketPage;
+import com.gitblit.wicket.pages.TicketsPage;
+import com.gitblit.wicket.pages.TicketPage;
import com.gitblit.wicket.pages.TreePage;
public class GitBlitWebApp extends WebApplication {
@@ -63,9 +63,9 @@
mount(new MixedParamUrlCodingStrategy("/patch", PatchPage.class, new String[] { "r", "h", "f" }));
mount(new MixedParamUrlCodingStrategy("/history", HistoryPage.class, new String[] { "r", "h", "f" }));
- // setup ticgit urls
- mount(new MixedParamUrlCodingStrategy("/ticgit", TicGitPage.class, new String[] { "r" }));
- mount(new MixedParamUrlCodingStrategy("/ticgittkt", TicGitTicketPage.class, new String[] { "r", "h", "f" }));
+ // setup ticket urls
+ mount(new MixedParamUrlCodingStrategy("/tickets", TicketsPage.class, new String[] { "r" }));
+ mount(new MixedParamUrlCodingStrategy("/ticket", TicketPage.class, new String[] { "r", "h", "f" }));
// setup login/logout urls, if we are using authentication
if (useAuthentication) {
diff --git a/src/com/gitblit/wicket/GitBlitWebApp.properties b/src/com/gitblit/wicket/GitBlitWebApp.properties
index 033742e..331fc29 100644
--- a/src/com/gitblit/wicket/GitBlitWebApp.properties
+++ b/src/com/gitblit/wicket/GitBlitWebApp.properties
@@ -34,7 +34,7 @@
gb.newRepository = new repository
gb.newUser = new user
gb.commitdiff = commitdiff
-gb.ticgit = ticgit
+gb.tickets = tickets
gb.pageFirst = first
gb.pagePrevious prev
gb.pageNext = next
diff --git a/src/com/gitblit/wicket/models/TicGitTicket.java b/src/com/gitblit/wicket/models/TicketModel.java
similarity index 87%
rename from src/com/gitblit/wicket/models/TicGitTicket.java
rename to src/com/gitblit/wicket/models/TicketModel.java
index 6bbb7be..39f3c90 100644
--- a/src/com/gitblit/wicket/models/TicGitTicket.java
+++ b/src/com/gitblit/wicket/models/TicketModel.java
@@ -6,7 +6,7 @@
import java.util.Date;
import java.util.List;
-public class TicGitTicket implements Serializable, Comparable<TicGitTicket> {
+public class TicketModel implements Serializable, Comparable<TicketModel> {
private static final long serialVersionUID = 1L;
@@ -22,13 +22,13 @@
public List<Comment> comments;
public List<String> tags;
- public TicGitTicket() {
+ public TicketModel() {
state = "open";
comments = new ArrayList<Comment>();
tags = new ArrayList<String>();
}
- public TicGitTicket(String ticketName) throws ParseException {
+ public TicketModel(String ticketName) throws ParseException {
state = "";
name = ticketName;
comments = new ArrayList<Comment>();
@@ -68,7 +68,7 @@
}
@Override
- public int compareTo(TicGitTicket o) {
+ public int compareTo(TicketModel o) {
return date.compareTo(o.date);
}
}
diff --git a/src/com/gitblit/wicket/pages/TicGitTicketPage.html b/src/com/gitblit/wicket/pages/TicketPage.html
similarity index 100%
rename from src/com/gitblit/wicket/pages/TicGitTicketPage.html
rename to src/com/gitblit/wicket/pages/TicketPage.html
diff --git a/src/com/gitblit/wicket/pages/TicGitTicketPage.java b/src/com/gitblit/wicket/pages/TicketPage.java
similarity index 88%
rename from src/com/gitblit/wicket/pages/TicGitTicketPage.java
rename to src/com/gitblit/wicket/pages/TicketPage.java
index b4c9cf5..1cfa809 100644
--- a/src/com/gitblit/wicket/pages/TicGitTicketPage.java
+++ b/src/com/gitblit/wicket/pages/TicketPage.java
@@ -12,18 +12,18 @@
import com.gitblit.wicket.GitBlitWebSession;
import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.TicGitTicket;
-import com.gitblit.wicket.models.TicGitTicket.Comment;
+import com.gitblit.wicket.models.TicketModel;
+import com.gitblit.wicket.models.TicketModel.Comment;
-public class TicGitTicketPage extends RepositoryPage {
+public class TicketPage extends RepositoryPage {
- public TicGitTicketPage(PageParameters params) {
+ public TicketPage(PageParameters params) {
super(params);
final String ticketFolder = WicketUtils.getPath(params);
Repository r = getRepository();
- TicGitTicket t = JGitUtils.getTicGitTicket(r, ticketFolder);
+ TicketModel t = JGitUtils.getTicket(r, ticketFolder);
add(new Label("ticketTitle", t.title));
add(new Label("ticketId", t.id));
diff --git a/src/com/gitblit/wicket/pages/TicGitPage.html b/src/com/gitblit/wicket/pages/TicketsPage.html
similarity index 100%
rename from src/com/gitblit/wicket/pages/TicGitPage.html
rename to src/com/gitblit/wicket/pages/TicketsPage.html
diff --git a/src/com/gitblit/wicket/pages/TicGitPage.java b/src/com/gitblit/wicket/pages/TicketsPage.java
similarity index 67%
rename from src/com/gitblit/wicket/pages/TicGitPage.java
rename to src/com/gitblit/wicket/pages/TicketsPage.java
index a03ee60..865b8bf 100644
--- a/src/com/gitblit/wicket/pages/TicGitPage.java
+++ b/src/com/gitblit/wicket/pages/TicketsPage.java
@@ -14,31 +14,31 @@
import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.TicGitTicket;
+import com.gitblit.wicket.models.TicketModel;
-public class TicGitPage extends RepositoryPage {
+public class TicketsPage extends RepositoryPage {
- public TicGitPage(PageParameters params) {
+ public TicketsPage(PageParameters params) {
super(params);
- List<TicGitTicket> tickets = JGitUtils.getTicGitTickets(getRepository());
+ List<TicketModel> tickets = JGitUtils.getTickets(getRepository());
// header
add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));
- ListDataProvider<TicGitTicket> ticketsDp = new ListDataProvider<TicGitTicket>(tickets);
- DataView<TicGitTicket> ticketsView = new DataView<TicGitTicket>("ticket", ticketsDp) {
+ ListDataProvider<TicketModel> ticketsDp = new ListDataProvider<TicketModel>(tickets);
+ DataView<TicketModel> ticketsView = new DataView<TicketModel>("ticket", ticketsDp) {
private static final long serialVersionUID = 1L;
int counter = 0;
- public void populateItem(final Item<TicGitTicket> item) {
- final TicGitTicket entry = item.getModelObject();
+ public void populateItem(final Item<TicketModel> item) {
+ final TicketModel entry = item.getModelObject();
Label stateLabel = new Label("ticketState", entry.state);
WicketUtils.setTicketCssClass(stateLabel, entry.state);
item.add(stateLabel);
item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession.get().getTimezone()));
item.add(new Label("ticketHandler", StringUtils.trimString(entry.handler.toLowerCase(), 30)));
- item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(entry.title, 80), TicGitTicketPage.class, newPathParameter(entry.name)));
+ item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(entry.title, 80), TicketPage.class, newPathParameter(entry.name)));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
@@ -49,6 +49,6 @@
@Override
protected String getPageName() {
- return getString("gb.ticgit");
+ return getString("gb.tickets");
}
}
diff --git a/src/com/gitblit/wicket/panels/HistoryPanel.java b/src/com/gitblit/wicket/panels/HistoryPanel.java
index 236e077..e787883 100644
--- a/src/com/gitblit/wicket/panels/HistoryPanel.java
+++ b/src/com/gitblit/wicket/panels/HistoryPanel.java
@@ -93,6 +93,7 @@
item.add(new RefsPanel("commitRefs", repositoryName, entry, allRefs));
+ // TODO links for folder
item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
item.add(new BookmarkablePageLink<Void>("commitdiff", CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
item.add(new BookmarkablePageLink<Void>("difftocurrent", BlobDiffPage.class, WicketUtils.newPathParameter(repositoryName, entry.getName(), path)).setEnabled(counter > 0));
diff --git a/src/com/gitblit/wicket/panels/PageLinksPanel.java b/src/com/gitblit/wicket/panels/PageLinksPanel.java
index 18cfad6..f8824db 100644
--- a/src/com/gitblit/wicket/panels/PageLinksPanel.java
+++ b/src/com/gitblit/wicket/panels/PageLinksPanel.java
@@ -24,7 +24,7 @@
import com.gitblit.wicket.pages.LogPage;
import com.gitblit.wicket.pages.SummaryPage;
import com.gitblit.wicket.pages.TagsPage;
-import com.gitblit.wicket.pages.TicGitPage;
+import com.gitblit.wicket.pages.TicketsPage;
import com.gitblit.wicket.pages.TreePage;
public class PageLinksPanel extends Panel {
@@ -41,7 +41,7 @@
put("branches", "gb.branches");
put("tags", "gb.tags");
put("tree", "gb.tree");
- put("ticgit", "gb.ticgit");
+ put("tickets", "gb.tickets");
}
};
@@ -55,14 +55,14 @@
add(new BookmarkablePageLink<Void>("tags", TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newRepositoryParameter(repositoryName)));
- // Get the repository ticgit setting
- boolean checkTicgit = GitBlit.self().settings().getBoolean(Keys.ticgit.global, false);
- checkTicgit |= GitBlit.self().settings().getBoolean(MessageFormat.format(Keys.ticgit._ROOT + ".{0}", repositoryName), false);
+ // Get the repository tickets setting
+ boolean checkTicgit = GitBlit.self().settings().getBoolean(Keys.tickets.global, false);
+ checkTicgit |= GitBlit.self().settings().getBoolean(MessageFormat.format(Keys.tickets._ROOT + ".{0}", repositoryName), false);
// Add dynamic repository extras
List<String> extras = new ArrayList<String>();
- if (checkTicgit && JGitUtils.getTicGitBranch(r) != null) {
- extras.add("ticgit");
+ if (checkTicgit && JGitUtils.getTicketsBranch(r) != null) {
+ extras.add("tickets");
}
ListDataProvider<String> extrasDp = new ListDataProvider<String>(extras);
@@ -71,9 +71,9 @@
public void populateItem(final Item<String> item) {
String extra = item.getModelObject();
- if (extra.equals("ticgit")) {
+ if (extra.equals("tickets")) {
item.add(new Label("extraSeparator", " | "));
- item.add(new LinkPanel("extraLink", null, "ticgit", TicGitPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
+ item.add(new LinkPanel("extraLink", null, "tickets", TicketsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
}
}
};
--
Gitblit v1.9.1