| | |
| | | import java.util.List;
|
| | |
|
| | | import org.eclipse.jgit.lib.Repository;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | |
| | | RefModel ticgitBranch = null;
|
| | | try {
|
| | | // search for ticgit branch in local heads
|
| | | for (RefModel ref : JGitUtils.getLocalBranches(r, -1)) {
|
| | | for (RefModel ref : JGitUtils.getLocalBranches(r, false, -1)) {
|
| | | if (ref.displayName.endsWith("ticgit")) {
|
| | | ticgitBranch = ref;
|
| | | break;
|
| | |
| | |
|
| | | // search for ticgit branch in remote heads
|
| | | if (ticgitBranch == null) {
|
| | | for (RefModel ref : JGitUtils.getRemoteBranches(r, -1)) {
|
| | | for (RefModel ref : JGitUtils.getRemoteBranches(r, false, -1)) {
|
| | | if (ref.displayName.endsWith("ticgit")) {
|
| | | ticgitBranch = ref;
|
| | | break;
|
| | |
| | | if (ticgitBranch == null) {
|
| | | return null;
|
| | | }
|
| | | List<PathModel> paths = JGitUtils.getFilesInPath(r, null, ticgitBranch.commit);
|
| | | RevCommit commit = (RevCommit) ticgitBranch.referencedObject;
|
| | | List<PathModel> paths = JGitUtils.getFilesInPath(r, null, commit);
|
| | | List<TicketModel> tickets = new ArrayList<TicketModel>();
|
| | | for (PathModel ticketFolder : paths) {
|
| | | if (ticketFolder.isTree()) {
|
| | |
| | | }
|
| | |
|
| | | private static void readTicketContents(Repository r, RefModel ticketsBranch, TicketModel ticket) {
|
| | | List<PathModel> ticketFiles = JGitUtils
|
| | | .getFilesInPath(r, ticket.name, ticketsBranch.commit);
|
| | | RevCommit commit = (RevCommit) ticketsBranch.referencedObject;
|
| | | List<PathModel> ticketFiles = JGitUtils.getFilesInPath(r, ticket.name, commit);
|
| | | for (PathModel file : ticketFiles) {
|
| | | String content = JGitUtils.getRawContentAsString(r, ticketsBranch.commit, file.path)
|
| | | .trim();
|
| | | String content = JGitUtils.getStringContent(r, commit.getTree(), file.path).trim();
|
| | | if (file.name.equals("TICKET_ID")) {
|
| | | ticket.id = content;
|
| | | } else if (file.name.equals("TITLE")) {
|