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

Unified Diff: presubmit_canned_checks.py

Issue 6581030: Add first changes needed for OWNERS file support. (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools
Patch Set: more linting Created 9 years, 10 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
« owners.py ('K') | « owners.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 79e030918bef92254281b482f52ec1a7f892236b..0d9d572476bc6937382e047ccdb3426a71fdbdce 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -624,3 +624,23 @@ def CheckBuildbotPendingBuilds(input_api, output_api, url, max_pendings,
'builds are pending.' % max_pendings,
long_text='\n'.join(out))]
return []
+
+
+def CheckOwners(input_api, output_api):
+ affected_files = set(input_api.change.AffectedFiles())
+ owners_db = input_api.owners_db
+
+ if input_api.is_commiting:
+ missing_files = owners_db.FilesNotCoveredBy(affected_files,
+ input_api.change.approvers)
+ if missing_files:
+ return [output_api.PresubmitPromptWarning('Missing approvals for: %s' %
+ ','.join(missing_files))]
+ return []
+ else:
+ if not input_api.change.get('R', None):
+ suggested_reviewers = owners_db.OwnersFor(affected_files)
+
+ # TODO(dpranke): consider getting multiple covering sets of reviewers
+ # and displaying them somehow?
+ input_api.change['R'] = ','.join(suggested_reviewers)
« owners.py ('K') | « owners.py ('k') | presubmit_support.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698