| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 import os as _os | 7 import os as _os |
| 8 _HERE = _os.path.dirname(_os.path.abspath(__file__)) | 8 _HERE = _os.path.dirname(_os.path.abspath(__file__)) |
| 9 | 9 |
| 10 | 10 |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 reviewers_plus_owner = reviewers.union(set([owner_email])) | 762 reviewers_plus_owner = reviewers.union(set([owner_email])) |
| 763 else: | 763 else: |
| 764 message = ('\nUntil the issue is uploaded, this list will include ' | 764 message = ('\nUntil the issue is uploaded, this list will include ' |
| 765 'directories for which you \nare an OWNER.') | 765 'directories for which you \nare an OWNER.') |
| 766 owner_email = '' | 766 owner_email = '' |
| 767 reviewers_plus_owner = set() | 767 reviewers_plus_owner = set() |
| 768 | 768 |
| 769 missing_directories = owners_db.directories_not_covered_by(affected_files, | 769 missing_directories = owners_db.directories_not_covered_by(affected_files, |
| 770 reviewers_plus_owner) | 770 reviewers_plus_owner) |
| 771 if missing_directories: | 771 if missing_directories: |
| 772 return [output('Missing %s for files in these directories:\n %s%s' % | 772 output_list = [ |
| 773 (needed, '\n '.join(missing_directories), message))] | 773 output('Missing %s for files in these directories:\n %s%s' % |
| 774 (needed, '\n '.join(missing_directories), message))] |
| 775 if not input_api.is_committing: |
| 776 suggested_owners = owners_db.reviewers_for(affected_files) |
| 777 output_list.append(output('Suggested OWNERS:\n %s' % |
| 778 ('\n '.join(suggested_owners)))) |
| 779 return output_list |
| 774 | 780 |
| 775 if input_api.is_committing and not reviewers: | 781 if input_api.is_committing and not reviewers: |
| 776 return [output('Missing LGTM from someone other than %s' % owner_email)] | 782 return [output('Missing LGTM from someone other than %s' % owner_email)] |
| 777 return [] | 783 return [] |
| 778 | 784 |
| 779 | 785 |
| 780 def _RietveldOwnerAndReviewers(input_api, email_regexp, approval_needed=False): | 786 def _RietveldOwnerAndReviewers(input_api, email_regexp, approval_needed=False): |
| 781 """Return the owner and reviewers of a change, if any. | 787 """Return the owner and reviewers of a change, if any. |
| 782 | 788 |
| 783 If approval_needed is True, only reviewers who have approved the change | 789 If approval_needed is True, only reviewers who have approved the change |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( | 949 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( |
| 944 input_api, output_api)) | 950 input_api, output_api)) |
| 945 snapshot("checking license") | 951 snapshot("checking license") |
| 946 results.extend(input_api.canned_checks.CheckLicense( | 952 results.extend(input_api.canned_checks.CheckLicense( |
| 947 input_api, output_api, license_header, source_file_filter=sources)) | 953 input_api, output_api, license_header, source_file_filter=sources)) |
| 948 snapshot("checking was uploaded") | 954 snapshot("checking was uploaded") |
| 949 results.extend(input_api.canned_checks.CheckChangeWasUploaded( | 955 results.extend(input_api.canned_checks.CheckChangeWasUploaded( |
| 950 input_api, output_api)) | 956 input_api, output_api)) |
| 951 snapshot("done") | 957 snapshot("done") |
| 952 return results | 958 return results |
| OLD | NEW |