svnjiraatlassian-fisheye

How can I programatically get Source code information from Issue Number in Jira Studio?


JIRA Studio (the "Issues" area, which is basically the part that just looks like "JIRA") includes a Source Tab. We link this to our Subversion instance (by including an issue number in the Message during check-in), this work great for human processes, but I can't find a way in the JIRA, Subversion, or Fisheye APIs to get at this link.

Ideally, I'd like to call getIssue on the JIRA api and have it return the Subversion Revision IDs along with all the other info it returns, but I'd take any sort of work-around available too! I will happily deal with SOAP, XML-RPC, REST, Command-Line, or carrier pigeon.

Here is what it looks like in the UI with the "Source Tab" data I want shown (sorry, new user, can't post images directly): Jira Screen Capture


Solution

  • I didn't try myself but if you have a look at the fisheye plugin, it might be very instructive how to access that information using an EQL query. http://confluence.atlassian.com/display/FISHEYE/EyeQL+Reference+Guide

    Code excerpt from the fisheye plugin: https://studio.plugins.atlassian.com/source/browse/~raw,r=157831/FISH/trunk/src/main/java/com/atlassian/jirafisheyeplugin/ChangeSetManagerImpl.java

    ` public ChangeSets getChangesetsForIssue(final String issueKey, String projectKey) { SearchConfig searchConfig = new SearchConfig(fisheyeConfig.getMaxIssueChangeSets(), false, false, true, SearchConfig.SEARCHTYPE_CHRONOLOGICAL);

        P4Query query = new P4Query() {
            public Object doQuery(FishEyeRepository rep, boolean searchJobId) throws IOException {
                EyeQLQuery query = new EyeQLQuery();
                query.setDir("/");
                if (searchJobId) {
                    query.addWhereClause(WhereClauseFactory.issueKeyOrJobIdMatches(issueKey));
                } else {
                    query.addWhereClause(WhereClauseFactory.issueKeyMatches(issueKey));
                }
                query.setOrderByDate(true);
                query.setGroupBy(EyeQLQuery.GROUP_BY_CHANGESET);
                query.addReturnClause("csid");
                return apiManager.callFisheye(rep, RestCommandFactory.query(query), CsIdParser.PARSER);
            }
        };
    
        ChangeSets changesets = searchForChangeSets(projectKey, query, searchConfig);
        changesets.applyFilter(new IssueKeyInCommentOrJobIdFilter(issueKey));
        return changesets;
    }
    

    `