Revert "Expect new types of approval records from Gerrit"
This reverts commit a68a1046953f844e76e284649077588f2595de58. Type of all mark records is translated to old Gerrit format (CRVW, APRV) Change-Id: Id92ba40d94aed78f13cdeee83b7dc2958eb1805c
This commit is contained in:
parent
cc06cf6e98
commit
3764260997
@ -165,7 +165,7 @@ def loc_filter(result, record, param_id):
|
|||||||
|
|
||||||
def mark_filter(result, record, param_id):
|
def mark_filter(result, record, param_id):
|
||||||
result_by_param = result[record[param_id]]
|
result_by_param = result[record[param_id]]
|
||||||
if record['type'] == 'Approved':
|
if record['type'] == 'APRV':
|
||||||
value = 'A'
|
value = 'A'
|
||||||
else:
|
else:
|
||||||
value = record['value']
|
value = record['value']
|
||||||
|
@ -151,7 +151,7 @@ def get_contribution_summary(records):
|
|||||||
commit_count += 1
|
commit_count += 1
|
||||||
loc += record['loc']
|
loc += record['loc']
|
||||||
elif record['record_type'] == 'mark':
|
elif record['record_type'] == 'mark':
|
||||||
if record['type'] == 'Approved':
|
if record['type'] == 'APRV':
|
||||||
marks['A'] += 1
|
marks['A'] += 1
|
||||||
else:
|
else:
|
||||||
marks[record['value']] += 1
|
marks[record['value']] += 1
|
||||||
|
@ -250,8 +250,8 @@ def get_single_plus_two_reviews_report(records):
|
|||||||
if record['record_type'] != 'mark':
|
if record['record_type'] != 'mark':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if ((record['branch'] == 'master') and
|
if (record['branch'] == 'master' and record['type'] == 'CRVW' and
|
||||||
(record['type'] == 'Code-Review') and (record['value'] == +2)):
|
record['value'] == +2):
|
||||||
review_id = record['review_id']
|
review_id = record['review_id']
|
||||||
review = memory_storage_inst.get_record_by_primary_key(review_id)
|
review = memory_storage_inst.get_record_by_primary_key(review_id)
|
||||||
if review and review['status'] == 'MERGED':
|
if review and review['status'] == 'MERGED':
|
||||||
|
@ -322,6 +322,10 @@ class RecordProcessor(object):
|
|||||||
mark['review_id'] = review['id']
|
mark['review_id'] = review['id']
|
||||||
mark['patch'] = int(patch['number'])
|
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)
|
self._update_record_and_user(mark)
|
||||||
return mark
|
return mark
|
||||||
|
|
||||||
@ -349,7 +353,8 @@ class RecordProcessor(object):
|
|||||||
continue # not reviewed by anyone
|
continue # not reviewed by anyone
|
||||||
|
|
||||||
for approval in patch['approvals']:
|
for approval in patch['approvals']:
|
||||||
if approval['type'] not in ('Code-Review', 'Approved'):
|
if approval['type'] not in ('CRVW', 'APRV',
|
||||||
|
'Code-Review', 'Approved'):
|
||||||
continue # keep only Code-Review and Approved
|
continue # keep only Code-Review and Approved
|
||||||
if ('email' not in approval['by'] or
|
if ('email' not in approval['by'] or
|
||||||
'username' not in approval['by']):
|
'username' not in approval['by']):
|
||||||
@ -677,8 +682,7 @@ class RecordProcessor(object):
|
|||||||
lambda: {'patch_number': 0, 'marks': []})
|
lambda: {'patch_number': 0, 'marks': []})
|
||||||
|
|
||||||
for record in self.runtime_storage_inst.get_all_records():
|
for record in self.runtime_storage_inst.get_all_records():
|
||||||
if ((record['record_type'] == 'mark') and
|
if record['record_type'] == 'mark' and record['type'] == 'CRVW':
|
||||||
(record['type'] == 'Code-Review')):
|
|
||||||
review_id = record['review_id']
|
review_id = record['review_id']
|
||||||
patch_number = record['patch']
|
patch_number = record['patch']
|
||||||
|
|
||||||
|
@ -122,11 +122,11 @@ def _generate_marks():
|
|||||||
'launchpad_id': 'john_doe', 'week': 2294, 'user_id': 'john_doe',
|
'launchpad_id': 'john_doe', 'week': 2294, 'user_id': 'john_doe',
|
||||||
'description': 'Approved', 'author_name': 'John Doe',
|
'description': 'Approved', 'author_name': 'John Doe',
|
||||||
'author_email': 'john_doe@gmail.com',
|
'author_email': 'john_doe@gmail.com',
|
||||||
'primary_key': str(uuid.uuid4()) + 'Approved',
|
'primary_key': str(uuid.uuid4()) + 'APRV',
|
||||||
'module': 'glance', 'patch': 2, 'record_type': 'mark',
|
'module': 'glance', 'patch': 2, 'record_type': 'mark',
|
||||||
'company_name': '*independent', 'branch': 'master',
|
'company_name': '*independent', 'branch': 'master',
|
||||||
'date': 1387860458, 'record_id': 37184, 'release': 'icehouse',
|
'date': 1387860458, 'record_id': 37184, 'release': 'icehouse',
|
||||||
'value': 1, 'type': 'Approved',
|
'value': 1, 'type': 'APRV',
|
||||||
'review_id': str(uuid.uuid4())}
|
'review_id': str(uuid.uuid4())}
|
||||||
yield mark
|
yield mark
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ class TestAPIStats(test_api.TestAPI):
|
|||||||
review_id=['0123456789', '9876543210'],
|
review_id=['0123456789', '9876543210'],
|
||||||
module=['glance'],
|
module=['glance'],
|
||||||
value=[1],
|
value=[1],
|
||||||
type=['Code-Review'],
|
type=['CRVW'],
|
||||||
author_name=['John Doe'],
|
author_name=['John Doe'],
|
||||||
user_id=['john_doe']),
|
user_id=['john_doe']),
|
||||||
test_api.make_records(record_type=['mark'],
|
test_api.make_records(record_type=['mark'],
|
||||||
|
@ -648,7 +648,7 @@ class TestRecordProcessor(testtools.TestCase):
|
|||||||
'username': 'bsmith'},
|
'username': 'bsmith'},
|
||||||
'createdOn': 1385470730,
|
'createdOn': 1385470730,
|
||||||
'approvals': [
|
'approvals': [
|
||||||
{'type': 'Code-Review', 'description': 'Code Review',
|
{'type': 'CRVW', 'description': 'Code Review',
|
||||||
'value': '1', 'grantedOn': 1385478464,
|
'value': '1', 'grantedOn': 1385478464,
|
||||||
'by': {'name': 'John Doe', 'email': 'john_doe@ibm.com',
|
'by': {'name': 'John Doe', 'email': 'john_doe@ibm.com',
|
||||||
'username': 'john_doe'}}]}]}
|
'username': 'john_doe'}}]}]}
|
||||||
@ -753,13 +753,13 @@ class TestRecordProcessor(testtools.TestCase):
|
|||||||
'username': 'bsmith'},
|
'username': 'bsmith'},
|
||||||
'createdOn': timestamp,
|
'createdOn': timestamp,
|
||||||
'approvals': [
|
'approvals': [
|
||||||
{'type': 'Code-Review', 'description': 'Code Review',
|
{'type': 'CRVW', 'description': 'Code Review',
|
||||||
'value': '2', 'grantedOn': timestamp,
|
'value': '2', 'grantedOn': timestamp,
|
||||||
'by': {
|
'by': {
|
||||||
'name': 'John Doe',
|
'name': 'John Doe',
|
||||||
'email': 'john_doe@ibm.com',
|
'email': 'john_doe@ibm.com',
|
||||||
'username': 'john_doe'}},
|
'username': 'john_doe'}},
|
||||||
{'type': 'Code-Review', 'description': 'Code Review',
|
{'type': 'CRVW', 'description': 'Code Review',
|
||||||
'value': '-1', 'grantedOn': timestamp - 1, # differ
|
'value': '-1', 'grantedOn': timestamp - 1, # differ
|
||||||
'by': {
|
'by': {
|
||||||
'name': 'Homer Simpson',
|
'name': 'Homer Simpson',
|
||||||
@ -936,13 +936,13 @@ class TestRecordProcessor(testtools.TestCase):
|
|||||||
'username': 'bsmith'},
|
'username': 'bsmith'},
|
||||||
'createdOn': timestamp,
|
'createdOn': timestamp,
|
||||||
'approvals': [
|
'approvals': [
|
||||||
{'type': 'Code-Review', 'description': 'Code Review',
|
{'type': 'CRVW', 'description': 'Code Review',
|
||||||
'value': '2', 'grantedOn': timestamp - 1,
|
'value': '2', 'grantedOn': timestamp - 1,
|
||||||
'by': {
|
'by': {
|
||||||
'name': 'Homer Simpson',
|
'name': 'Homer Simpson',
|
||||||
'email': 'hsimpson@gmail.com',
|
'email': 'hsimpson@gmail.com',
|
||||||
'username': 'homer'}},
|
'username': 'homer'}},
|
||||||
{'type': 'Code-Review', 'description': 'Code Review',
|
{'type': 'CRVW', 'description': 'Code Review',
|
||||||
'value': '-2', 'grantedOn': timestamp,
|
'value': '-2', 'grantedOn': timestamp,
|
||||||
'by': {
|
'by': {
|
||||||
'name': 'John Doe',
|
'name': 'John Doe',
|
||||||
@ -959,19 +959,19 @@ class TestRecordProcessor(testtools.TestCase):
|
|||||||
'username': 'bsmith'},
|
'username': 'bsmith'},
|
||||||
'createdOn': timestamp + 1,
|
'createdOn': timestamp + 1,
|
||||||
'approvals': [
|
'approvals': [
|
||||||
{'type': 'Code-Review', 'description': 'Code Review',
|
{'type': 'CRVW', 'description': 'Code Review',
|
||||||
'value': '1', 'grantedOn': timestamp + 2,
|
'value': '1', 'grantedOn': timestamp + 2,
|
||||||
'by': {
|
'by': {
|
||||||
'name': 'Homer Simpson',
|
'name': 'Homer Simpson',
|
||||||
'email': 'hsimpson@gmail.com',
|
'email': 'hsimpson@gmail.com',
|
||||||
'username': 'homer'}},
|
'username': 'homer'}},
|
||||||
{'type': 'Code-Review', 'description': 'Code Review',
|
{'type': 'CRVW', 'description': 'Code Review',
|
||||||
'value': '-1', 'grantedOn': timestamp + 3,
|
'value': '-1', 'grantedOn': timestamp + 3,
|
||||||
'by': {
|
'by': {
|
||||||
'name': 'Bart Simpson',
|
'name': 'Bart Simpson',
|
||||||
'email': 'bsimpson@gmail.com',
|
'email': 'bsimpson@gmail.com',
|
||||||
'username': 'bart'}},
|
'username': 'bart'}},
|
||||||
{'type': 'Code-Review', 'description': 'Code Review',
|
{'type': 'CRVW', 'description': 'Code Review',
|
||||||
'value': '2', 'grantedOn': timestamp + 4,
|
'value': '2', 'grantedOn': timestamp + 4,
|
||||||
'by': {
|
'by': {
|
||||||
'name': 'John Doe',
|
'name': 'John Doe',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user