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

Unified Diff: presubmit_canned_checks.py

Issue 7058025: Switch CheckOwners to use input_api.rietveld. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix it for real this time Created 9 years, 7 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 | rietveld.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 7342925190b757191745c988195a4f3db8a880fb..aedd741e1eae94578c8d0c5278b631c4abc744c2 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -741,6 +741,10 @@ def CheckOwners(input_api, output_api, source_file_filter=None):
owners_db = input_api.owners_db
owner_email, approvers = _RietveldOwnerAndApprovers(input_api,
owners_db.email_regexp)
+ if not owner_email:
+ return [output_api.PresubmitWarning(
+ 'The issue was not uploaded so you have no OWNER approval.')]
+
approvers_plus_owner = approvers.union(set([owner_email]))
missing_files = owners_db.files_not_covered_by(affected_files,
@@ -757,13 +761,11 @@ def CheckOwners(input_api, output_api, source_file_filter=None):
def _RietveldOwnerAndApprovers(input_api, email_regexp):
"""Return the owner and approvers of a change, if any."""
- # TODO(dpranke): Should figure out if input_api.host_url is supposed to
- # be a host or a scheme+host and normalize it there.
- host = input_api.host_url
- if not host.startswith('http://') and not host.startswith('https://'):
- host = 'http://' + host
- url = '%s/api/%s?messages=true' % (host, input_api.change.issue)
- issue_props = input_api.json.load(input_api.urllib2.urlopen(url))
+ if not input_api.change.issue:
+ return None, None
+
+ issue_props = input_api.rietveld.get_issue_properties(
+ int(input_api.change.issue), True)
owner_email = issue_props['owner_email']
def match_reviewer(r):
« no previous file with comments | « no previous file | rietveld.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698