diff options
author | James Moger <james.moger@gitblit.com> | 2011-04-17 12:06:29 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2011-04-17 12:06:29 -0400 |
commit | 9802a766a28bfcb0ae01494ebfa1cbeb11e71809 (patch) | |
tree | 208ee6239872f47206e2070546f5fa2b3d76f779 /src/com | |
parent | 01bd346efe98af0f05f23f897c0819d2df8d856c (diff) | |
download | gitblit-9802a766a28bfcb0ae01494ebfa1cbeb11e71809.tar.gz gitblit-9802a766a28bfcb0ae01494ebfa1cbeb11e71809.zip |
Rename ticgit integration to tickets.
The current ticgit implementation is based on ticgit.net, a BSD
implementation for C#. Jeff Welling advises using commit
bf57b032e030bd16a7b2 (2009-01-27) from ticgit as the last MIT licensed
commit.
A more complete implementation will be based on this version of the
original Ruby sources. It remains unclear if I will support using the
"ticgit" branch name or not. I purposefully haven't looked at any of
the GPL improvements by Jeff, but I can see from the readme at GitHub
that he has renamed the branch to "ticgit-ng" which I have no plans on
supporting as I do not want to taint GitBlit with GPL code.
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/gitblit/tests/JGitUtilsTest.java | 6 | ||||
-rw-r--r-- | src/com/gitblit/utils/JGitUtils.java | 46 | ||||
-rw-r--r-- | src/com/gitblit/wicket/GitBlitWebApp.java | 10 | ||||
-rw-r--r-- | src/com/gitblit/wicket/GitBlitWebApp.properties | 2 | ||||
-rw-r--r-- | src/com/gitblit/wicket/models/TicketModel.java (renamed from src/com/gitblit/wicket/models/TicGitTicket.java) | 8 | ||||
-rw-r--r-- | src/com/gitblit/wicket/pages/TicketPage.html (renamed from src/com/gitblit/wicket/pages/TicGitTicketPage.html) | 0 | ||||
-rw-r--r-- | src/com/gitblit/wicket/pages/TicketPage.java (renamed from src/com/gitblit/wicket/pages/TicGitTicketPage.java) | 10 | ||||
-rw-r--r-- | src/com/gitblit/wicket/pages/TicketsPage.html (renamed from src/com/gitblit/wicket/pages/TicGitPage.html) | 0 | ||||
-rw-r--r-- | src/com/gitblit/wicket/pages/TicketsPage.java (renamed from src/com/gitblit/wicket/pages/TicGitPage.java) | 20 | ||||
-rw-r--r-- | src/com/gitblit/wicket/panels/HistoryPanel.java | 1 | ||||
-rw-r--r-- | src/com/gitblit/wicket/panels/PageLinksPanel.java | 18 |
11 files changed, 61 insertions, 60 deletions
diff --git a/src/com/gitblit/tests/JGitUtilsTest.java b/src/com/gitblit/tests/JGitUtilsTest.java index c77aaaf1..b6b497f0 100644 --- a/src/com/gitblit/tests/JGitUtilsTest.java +++ b/src/com/gitblit/tests/JGitUtilsTest.java @@ -17,7 +17,7 @@ import org.eclipse.jgit.storage.file.FileRepository; 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 class JGitUtilsTest extends TestCase { 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 7128f722..075ad81b 100644 --- a/src/com/gitblit/utils/JGitUtils.java +++ b/src/com/gitblit/utils/JGitUtils.java @@ -46,8 +46,8 @@ import org.slf4j.LoggerFactory; 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 @@ public class JGitUtils { 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 @@ public class JGitUtils { // 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 @@ public class JGitUtils { 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 @@ public class JGitUtils { 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 @@ public class JGitUtils { 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 28f62625..74057c99 100644 --- a/src/com/gitblit/wicket/GitBlitWebApp.java +++ b/src/com/gitblit/wicket/GitBlitWebApp.java @@ -25,8 +25,8 @@ import com.gitblit.wicket.pages.RepositoriesPage; 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 @@ public class GitBlitWebApp extends WebApplication { 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 033742eb..331fc294 100644 --- a/src/com/gitblit/wicket/GitBlitWebApp.properties +++ b/src/com/gitblit/wicket/GitBlitWebApp.properties @@ -34,7 +34,7 @@ gb.ticket = ticket 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 index 6bbb7be0..39f3c902 100644 --- a/src/com/gitblit/wicket/models/TicGitTicket.java +++ b/src/com/gitblit/wicket/models/TicketModel.java @@ -6,7 +6,7 @@ import java.util.ArrayList; 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 class TicGitTicket implements Serializable, Comparable<TicGitTicket> { 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 @@ public class TicGitTicket implements Serializable, Comparable<TicGitTicket> { }
@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 index 56e29804..56e29804 100644 --- a/src/com/gitblit/wicket/pages/TicGitTicketPage.html +++ b/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 index b4c9cf55..1cfa8090 100644 --- a/src/com/gitblit/wicket/pages/TicGitTicketPage.java +++ b/src/com/gitblit/wicket/pages/TicketPage.java @@ -12,18 +12,18 @@ import com.gitblit.utils.StringUtils; 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 index eb74b125..eb74b125 100644 --- a/src/com/gitblit/wicket/pages/TicGitPage.html +++ b/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 index a03ee607..865b8bf8 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.GitBlitWebSession; 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 @@ public class TicGitPage extends RepositoryPage { @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 236e077b..e7878838 100644 --- a/src/com/gitblit/wicket/panels/HistoryPanel.java +++ b/src/com/gitblit/wicket/panels/HistoryPanel.java @@ -93,6 +93,7 @@ public class HistoryPanel extends BasePanel { 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 18cfad62..f8824db5 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.BranchesPage; 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 @@ public class PageLinksPanel extends Panel { put("branches", "gb.branches");
put("tags", "gb.tags");
put("tree", "gb.tree");
- put("ticgit", "gb.ticgit");
+ put("tickets", "gb.tickets");
}
};
@@ -55,14 +55,14 @@ public class PageLinksPanel extends Panel { 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 class PageLinksPanel extends Panel { 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)));
}
}
};
|