From a75d1dab87b548c118fa16e59f749f844479a5dc Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Wed, 2 Apr 2014 00:19:01 +0800 Subject: [PATCH] New API method to get pull information from the tracker --- lib/jira.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/jira.py b/lib/jira.py index a4f60db..44bf04f 100644 --- a/lib/jira.py +++ b/lib/jira.py @@ -148,6 +148,30 @@ class Jira(object): return issue + def getPullInfo(self, key): + """Get the pull information organised by branch""" + + fields = self.getIssue(key).get('named') + infos = { + 'repo': None, + 'branches': {} + } + + for key, value in C.get('tracker.fieldnames').iteritems(): + if key == 'repositoryurl': + infos['repo'] = fields.get(value) + + elif key == 'master' or key.isdigit(): + infos['branches'][key] = { + 'branch': fields.get(value['branch']), + 'compare': fields.get(value['diffurl']) + } + else: + # We don't know that field... + continue + + return infos + def getServerInfo(self): """Load the version info from the jira server using a rest api call""" resp = self.request('serverInfo') -- 2.11.0