OLD | NEW |
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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, source_file_filter=None): | 629 def CheckOwners(input_api, output_api, source_file_filter=None): |
630 affected_files = set([f.LocalPath() for f in | 630 affected_files = set([f.LocalPath() for f in |
631 input_api.change.AffectedFiles(source_file_filter)]) | 631 input_api.change.AffectedFiles(source_file_filter)]) |
632 owners_db = input_api.owners_db | 632 owners_db = input_api.owners_db |
633 | 633 |
634 if input_api.is_committing: | 634 if input_api.is_committing: |
635 missing_files = owners_db.FilesNotCoveredBy(affected_files, | 635 missing_files = owners_db.files_not_covered_by(affected_files, |
636 input_api.change.approvers) | 636 input_api.change.approvers) |
637 if missing_files: | 637 if missing_files: |
638 return [output_api.PresubmitPromptWarning('Missing approvals for: %s' % | 638 return [output_api.PresubmitError('Missing owner LGTM for: %s' % |
639 ','.join(missing_files))] | 639 ','.join(missing_files))] |
640 return [] | 640 return [] |
641 elif input_api.change.tags.get('R'): | 641 elif input_api.change.tags.get('R'): |
642 return [] | 642 return [] |
643 | 643 |
644 suggested_reviewers = owners_db.ReviewersFor(affected_files) | 644 suggested_reviewers = owners_db.reviewers_for(affected_files) |
645 # TODO(dpranke): Actually propagate the info back. | 645 return [output_api.PresubmitAddText('R=%s' % ','.join(suggested_reviewers))] |
646 return [] | |
OLD | NEW |