Merge "Include aggregate change revisions in owner data"

This commit is contained in:
Zuul 2020-02-28 21:41:49 +00:00 committed by Gerrit Code Review
commit 121c3dcd6f

View File

@ -318,6 +318,10 @@ def main(options):
# The change number, for ease of tracking # The change number, for ease of tracking
number = change['_number'] number = change['_number']
# How many revisions this change had before merging
revisions = list(
change['revisions'].values())[0]['_number']
# We index owners by their unique Gerrit # We index owners by their unique Gerrit
# account Id numbers # account Id numbers
owner = change['owner']['_account_id'] owner = change['owner']['_account_id']
@ -375,6 +379,7 @@ def main(options):
'newest_id': number, 'newest_id': number,
'oldest': merged, 'oldest': merged,
'oldest_id': number, 'oldest_id': number,
'revisions': revisions,
'username': change['owner'].get('username'), 'username': change['owner'].get('username'),
} }
@ -384,6 +389,7 @@ def main(options):
# dates # dates
else: else:
owners[owner]['count'] += 1 owners[owner]['count'] += 1
owners[owner]['revisions'] += revisions
if merged > owners[owner]['newest']: if merged > owners[owner]['newest']:
owners[owner]['newest'] = merged owners[owner]['newest'] = merged
owners[owner]['newest_id'] = number owners[owner]['newest_id'] = number
@ -441,6 +447,7 @@ def main(options):
# update newest/oldest dates # update newest/oldest dates
if owner in projects[project]: if owner in projects[project]:
projects[project][owner]['count'] += 1 projects[project][owner]['count'] += 1
projects[project][owner]['revisions'] += revisions
if merged > projects[project][owner]['newest']: if merged > projects[project][owner]['newest']:
projects[project][owner]['newest'] = merged projects[project][owner]['newest'] = merged
projects[project][owner]['newest_id'] = number projects[project][owner]['newest_id'] = number
@ -458,6 +465,7 @@ def main(options):
'newest_id': number, 'newest_id': number,
'oldest': merged, 'oldest': merged,
'oldest_id': number, 'oldest_id': number,
'revisions': revisions,
} }
# The negative counter will be used as a makeshift account Id # The negative counter will be used as a makeshift account Id
@ -497,6 +505,7 @@ def main(options):
'oldest': stamp, 'oldest': stamp,
'oldest_id': 0, 'oldest_id': 0,
'preferred': address, 'preferred': address,
'revisions': -1,
'username': '_non_code_contributor', 'username': '_non_code_contributor',
} }
if owner not in projects[project]: if owner not in projects[project]:
@ -506,6 +515,7 @@ def main(options):
'newest_id': 0, 'newest_id': 0,
'oldest': stamp, 'oldest': stamp,
'oldest_id': 0, 'oldest_id': 0,
'revisions': -1,
} }
counter += 1 counter += 1
@ -619,7 +629,8 @@ def main(options):
# merged dates with the team-specific value rather than # merged dates with the team-specific value rather than
# using the count from the global set # using the count from the global set
for field in ( for field in (
'count', 'newest', 'newest_id', 'oldest', 'oldest_id'): 'count', 'newest', 'newest_id', 'oldest', 'oldest_id',
'revisions'):
output[owner][field] = projects[project][owner][field] output[owner][field] = projects[project][owner][field]
# Append preferred member addresses to the PTL electoral rolls # Append preferred member addresses to the PTL electoral rolls