From: Frederic Massart Date: Tue, 1 Apr 2014 16:19:01 +0000 (+0800) Subject: New API method to get pull information from the tracker X-Git-Tag: v1.0~11 X-Git-Url: https://git.cameron1729.xyz/?a=commitdiff_plain;h=a75d1dab87b548c118fa16e59f749f844479a5dc;p=mdk.git New API method to get pull information from the tracker --- 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')