From: Victor GarcĂ­a Date: Fri, 21 Dec 2012 11:23:04 +0000 (+0100) Subject: getting hg revision from mercurialNodeName because there might be builds with empty... X-Git-Tag: v0.2.23~254^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e00ff51069ad7b9d47e36037ab195fe21b5a6435;p=tools%2Fpython-jenkinsapi.git getting hg revision from mercurialNodeName because there might be builds with empty changesets list --- diff --git a/jenkinsapi/build.py b/jenkinsapi/build.py index 35dca86..254fc54 100644 --- a/jenkinsapi/build.py +++ b/jenkinsapi/build.py @@ -51,10 +51,7 @@ class Build(JenkinsBase): return head['revision']['SHA1'] def _get_hg_rev(self): - revs = [(item['date'], item['node']) - for item in self._data['changeSet']['items']] - revs = sorted(revs, key=lambda tup: float(tup[0].split('-')[0])) - return revs[-1][1] # get last commit revision + return [x['mercurialNodeName'] for x in self._data['actions'] if 'mercurialNodeName' in x][0] def get_duration(self): return self._data["duration"]