def get_changes(gerrit, device=None, before=-1, version='14.1'): last_release = -1 query = 'status:merged' if last_release != -1: query += ' after:' + datetime_to_gerrit(last_release) if before != -1: query += ' before:' + datetime_to_gerrit( datetime.fromtimestamp(before)) changes = gerrit.changes(query=query, n=100, limit=100) nightly_changes = [] last = 0 for c in changes: last = get_timestamp(c.submitted) if is_related_change(gerrit, device, version, c.project, c.branch): nightly_changes.append({ 'project': c.project, 'subject': c.subject, 'submitted': get_timestamp(c.submitted), 'url': c.url, 'owner': c.owner, 'labels': c.labels }) return {'last': last, 'res': nightly_changes}
def get_changes(gerrit, device=None, before=-1, version='8.1', status_url='#'): last_release = -1 query = 'status:merged' if last_release != -1: query += ' after:' + datetime_to_gerrit(last_release) if before != -1: query += ' before:' + datetime_to_gerrit( datetime.fromtimestamp(before)) changes = gerrit.changes(query=query, n=100, limit=100) nightly_changes = [] last = 0 try: for c in changes: last = get_timestamp(c.updated) if is_related_change(gerrit, device, version, c.project, c.branch): nightly_changes.append({ 'project': c.project, 'subject': c.subject, 'submitted': get_timestamp(c.submitted), 'updated': get_timestamp(c.updated), 'url': c.url, 'owner': c.owner }) except ConnectionError as e: print(e) nightly_changes.append({ 'project': None, 'subject': None, 'submitted': 0, 'updated': 0, 'url': status_url, 'owner': None }) return {'last': last, 'res': nightly_changes}
def get_changes(gerrit, device=None, before=-1, versions=None): if versions is None: versions = [] query = ['status:merged'] if before != -1: query.append('before:%s' % datetime_to_gerrit(datetime.fromtimestamp(before))) changes = gerrit.changes(query=' '.join(query), n=100, limit=100) last = 0 for change in changes: last = get_timestamp(change.updated) return filter_changes(changes, device, versions), last