Commit c9ebbd24 authored by rmistry's avatar rmistry Committed by Commit bot

Fix logic to detect Gerrit CL in CQ

BUG=chromium:656042

Review-Url: https://codereview.chromium.org/2419123002
parent 49ea106b
...@@ -2337,8 +2337,15 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase): ...@@ -2337,8 +2337,15 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
cq_label = data['labels'].get('Commit-Queue', {}) cq_label = data['labels'].get('Commit-Queue', {})
if cq_label: if cq_label:
# Vote value is a stringified integer, which we expect from 0 to 2. votes = cq_label.get('all', [])
vote_value = cq_label.get('value', '0') highest_vote = 0
for v in votes:
highest_vote = max(highest_vote, v.get('value', 0))
vote_value = str(highest_vote)
if vote_value != '0':
# Add a '+' if the value is not 0 to match the values in the label.
# The cq_label does not have negatives.
vote_value = '+' + vote_value
vote_text = cq_label.get('values', {}).get(vote_value, '') vote_text = cq_label.get('values', {}).get(vote_value, '')
if vote_text.lower() == 'commit': if vote_text.lower() == 'commit':
return 'commit' return 'commit'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment