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

Side by Side Diff: presubmit_canned_checks.py

Issue 6591064: add source_file_filter to CheckOwners() presubmit check (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Generic presubmit checks that can be reused by other presubmit checks.""" 5 """Generic presubmit checks that can be reused by other presubmit checks."""
6 6
7 ### Description checks 7 ### Description checks
8 8
9 def CheckChangeHasTestField(input_api, output_api): 9 def CheckChangeHasTestField(input_api, output_api):
10 """Requires that the changelist have a TEST= field.""" 10 """Requires that the changelist have a TEST= field."""
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 out.append('%s has %d build(s) pending' % 619 out.append('%s has %d build(s) pending' %
620 (builder_name, pending_builds_len)) 620 (builder_name, pending_builds_len))
621 if out: 621 if out:
622 return [output_api.PresubmitPromptWarning( 622 return [output_api.PresubmitPromptWarning(
623 'Build(s) pending. It is suggested to wait that no more than %d ' 623 'Build(s) pending. It is suggested to wait that no more than %d '
624 'builds are pending.' % max_pendings, 624 'builds are pending.' % max_pendings,
625 long_text='\n'.join(out))] 625 long_text='\n'.join(out))]
626 return [] 626 return []
627 627
628 628
629 def CheckOwners(input_api, output_api): 629 def CheckOwners(input_api, output_api, source_file_filter=None):
630 affected_files = set(input_api.change.AffectedFiles()) 630 affected_files = set(input_api.change.AffectedFiles(source_file_filter))
631 owners_db = input_api.owners_db 631 owners_db = input_api.owners_db
632 632
633 if input_api.is_commiting: 633 if input_api.is_commiting:
634 missing_files = owners_db.FilesNotCoveredBy(affected_files, 634 missing_files = owners_db.FilesNotCoveredBy(affected_files,
635 input_api.change.approvers) 635 input_api.change.approvers)
636 if missing_files: 636 if missing_files:
637 return [output_api.PresubmitPromptWarning('Missing approvals for: %s' % 637 return [output_api.PresubmitPromptWarning('Missing approvals for: %s' %
638 ','.join(missing_files))] 638 ','.join(missing_files))]
639 return [] 639 return []
640 else: 640 else:
641 if not input_api.change.get('R', None): 641 if not input_api.change.get('R', None):
642 suggested_reviewers = owners_db.OwnersFor(affected_files) 642 suggested_reviewers = owners_db.OwnersFor(affected_files)
643 643
644 # TODO(dpranke): consider getting multiple covering sets of reviewers 644 # TODO(dpranke): consider getting multiple covering sets of reviewers
645 # and displaying them somehow? 645 # and displaying them somehow?
646 input_api.change['R'] = ','.join(suggested_reviewers) 646 input_api.change['R'] = ','.join(suggested_reviewers)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698