Changed types of reviews according to Gerrit 2.8
In Gerrit 2.8 type of marks are changed, CRVW became Code-Review, APRV turned into Workflow with value +1. Previously Stackalytics handled this by mapping from new types to old, but this doesn't support case of approval marks. Closes bug 1324080 Change-Id: I7de747b8df5722b840eea0f42b67665058a7ad03
This commit is contained in:
@@ -307,7 +307,7 @@ class RecordProcessor(object):
|
||||
def _make_mark_record(self, review, patch, approval):
|
||||
# copy everything and flatten user data
|
||||
mark = dict([(k, v) for k, v in six.iteritems(approval)
|
||||
if k not in ['by', 'grantedOn', 'value']])
|
||||
if k not in ['by', 'grantedOn', 'value', 'description']])
|
||||
reviewer = approval['by']
|
||||
|
||||
mark['record_type'] = 'mark'
|
||||
@@ -322,10 +322,6 @@ class RecordProcessor(object):
|
||||
mark['review_id'] = review['id']
|
||||
mark['patch'] = int(patch['number'])
|
||||
|
||||
# map type from new Gerrit to old
|
||||
mark['type'] = {'Approved': 'APRV', 'Code-Review': 'CRVW',
|
||||
'Verified': 'VRIF'}.get(mark['type'], mark['type'])
|
||||
|
||||
self._update_record_and_user(mark)
|
||||
return mark
|
||||
|
||||
@@ -353,9 +349,8 @@ class RecordProcessor(object):
|
||||
continue # not reviewed by anyone
|
||||
|
||||
for approval in patch['approvals']:
|
||||
if approval['type'] not in ('CRVW', 'APRV',
|
||||
'Code-Review', 'Approved'):
|
||||
continue # keep only Code-Review and Approved
|
||||
if approval['type'] not in ('Code-Review', 'Workflow'):
|
||||
continue # keep only Code-Review and Workflow
|
||||
if ('email' not in approval['by'] or
|
||||
'username' not in approval['by']):
|
||||
continue # ignore
|
||||
@@ -683,7 +678,8 @@ class RecordProcessor(object):
|
||||
lambda: {'patch_number': 0, 'marks': []})
|
||||
|
||||
for record in self.runtime_storage_inst.get_all_records():
|
||||
if record['record_type'] == 'mark' and record['type'] == 'CRVW':
|
||||
if (record['record_type'] == 'mark' and
|
||||
record['type'] == 'Code-Review'):
|
||||
review_id = record['review_id']
|
||||
patch_number = record['patch']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user