def getChangeForBuild(self, build, revision): if not build or not build.getChanges(): # Forced build return DevBuild(revision, build, None) for change in build.getChanges(): if change.revision == revision: return change # No matching change, return the last change in build. changes = list(build.getChanges()) changes.sort(key=self.comparator.getSortingKey()) return changes[-1]
def _parse_changes(data): pushes = json.loads(data) changes = [] for push_id, push_data in pushes.iteritems(): push_time = push_data['date'] push_user = push_data['user'] for cset in push_data['changesets']: change = {} change['updated'] = push_time change['author'] = push_user change['changeset'] = cset['node'] change['files'] = cset['files'] change['branch'] = cset['branch'] change['comments'] = cset['desc'] changes.append(change) # Sort by push date # Changes in the same push have their order preserved because python list # sorts are stable. The leaf of each push is sorted at the end of the list # of changes for that push. changes.sort(key=lambda c: c['updated']) return changes
def _parse_changes(data): pushes = json.loads(data) changes = [] for push_id, push_data in pushes.iteritems(): push_time = push_data['date'] push_user = push_data['user'] for cset in push_data['changesets']: change = {} change['updated'] = push_time change['author'] = push_user change['changeset'] = cset['node'] change['files'] = cset['files'] change['branch'] = cset['branch'] change['comments'] = cset['desc'] changes.append(change) # Sort by push date # Changes in the same push have their order preserved because python list # sorts are stable. The leaf of each push is sorted at the end of the list # of changes for that push. changes.sort(key=lambda c:c['updated']) return changes