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

三世轮回 提交于 2019-12-12 06:29:31

问题


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


回答1:


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;
}

`



来源:https://stackoverflow.com/questions/5314197/how-can-i-programatically-get-source-code-information-from-issue-number-in-jira

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!