Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Unified Diff: presubmit_support.py

Issue 2178673002: Have presubmit accept various Code-Review label configurations (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Tests and comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/presubmit_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_support.py
diff --git a/presubmit_support.py b/presubmit_support.py
index 0e85eb0b7a622c9a6e7d0f0d3c71dec75f9016de..807da4a05d1458751207f96cc02f8ff21a35cd10 100755
--- a/presubmit_support.py
+++ b/presubmit_support.py
@@ -244,13 +244,10 @@ class GerritAccessor(object):
return self.GetChangeInfo(issue)['owner']['email']
def GetChangeReviewers(self, issue, approving_only=True):
- # Gerrit has 'approved' sub-section, but it only lists 1 approver.
- # So, if we look only for approvers, we have to look at all anyway.
- # Also, assume LGTM means Code-Review label == 2. Other configurations
- # aren't supported.
- return [r['email']
- for r in self.GetChangeInfo(issue)['labels']['Code-Review']['all']
- if not approving_only or '2' == str(r.get('value', 0))]
+ cr = self.GetChangeInfo(issue)['labels']['Code-Review']
+ max_value = max(int(k) for k in cr['values'].keys())
+ return [r['email'] for r in cr['all']
+ if not approving_only or r.get('value', 0) == max_value]
class OutputApi(object):
« no previous file with comments | « no previous file | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698