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

Unified Diff: presubmit_canned_checks.py

Issue 195793021: Infer CL author and reviewer list from local state if the issue has not previously been uploaded. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Add an additional test Created 6 years, 9 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 | « git_cl.py ('k') | presubmit_support.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_canned_checks.py
diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py
index d0376bd79b325a356841b067bc2953a9ec3be97b..a48a0c627de361c6927477c7734bf2b7ab29a543 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -852,6 +852,16 @@ def _GetRietveldIssueProps(input_api, messages):
issue=int(issue), messages=messages)
+def _ReviewersFromChange(change):
+ """Return the reviewers specified in the |change|, if any."""
+ reviewers = set()
+ if change.R:
+ reviewers.update(set([r.strip() for r in change.R.split(',')]))
+ if change.TBR:
+ reviewers.update(set([r.strip() for r in change.TBR.split(',')]))
+ return reviewers
+
+
def _RietveldOwnerAndReviewers(input_api, email_regexp, approval_needed=False):
"""Return the owner and reviewers of a change, if any.
@@ -860,7 +870,10 @@ def _RietveldOwnerAndReviewers(input_api, email_regexp, approval_needed=False):
"""
issue_props = _GetRietveldIssueProps(input_api, True)
if not issue_props:
- return None, set()
+ reviewers = set()
+ if not approval_needed:
+ reviewers = _ReviewersFromChange(input_api.change)
+ return None, reviewers
if not approval_needed:
return issue_props['owner_email'], set(issue_props['reviewers'])
« no previous file with comments | « git_cl.py ('k') | presubmit_support.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698