Chromium Code Reviews| 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 | 7 |
| 8 ### Description checks | 8 ### Description checks |
| 9 | 9 |
| 10 def CheckChangeHasTestField(input_api, output_api): | 10 def CheckChangeHasTestField(input_api, output_api): |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 if text.strip() == '': | 59 if text.strip() == '': |
| 60 if input_api.is_committing: | 60 if input_api.is_committing: |
| 61 return [output_api.PresubmitError('Add a description.')] | 61 return [output_api.PresubmitError('Add a description.')] |
| 62 else: | 62 else: |
| 63 return [output_api.PresubmitNotifyResult('Add a description.')] | 63 return [output_api.PresubmitNotifyResult('Add a description.')] |
| 64 return [] | 64 return [] |
| 65 | 65 |
| 66 | 66 |
| 67 def CheckChangeWasUploaded(input_api, output_api): | 67 def CheckChangeWasUploaded(input_api, output_api): |
| 68 """Checks that the issue was uploaded before committing.""" | 68 """Checks that the issue was uploaded before committing.""" |
| 69 if (input_api.is_committing and | 69 if input_api.is_committing and not input_api.change.issue: |
| 70 (not input_api.change.issue or not input_api.change.patchset)): | 70 # If patchset is None, it's likely a patched in issue directly from |
| 71 # Rietveld, e.g. a patch contributed by a non-committer that was patched in | |
| 72 # by a committer to be checked-in. | |
|
Dirk Pranke
2011/07/25 21:03:15
Okay, I follow the comment this time, but it is a
| |
| 71 return [output_api.PresubmitError( | 73 return [output_api.PresubmitError( |
| 72 'Issue wasn\'t uploaded. Please upload first.')] | 74 'Issue wasn\'t uploaded. Please upload first.')] |
| 73 return [] | 75 return [] |
| 74 | 76 |
| 75 | 77 |
| 76 ### Content checks | 78 ### Content checks |
| 77 | 79 |
| 78 def CheckDoNotSubmitInFiles(input_api, output_api): | 80 def CheckDoNotSubmitInFiles(input_api, output_api): |
| 79 """Checks that the user didn't add 'DO NOT ' + 'SUBMIT' to any files.""" | 81 """Checks that the user didn't add 'DO NOT ' + 'SUBMIT' to any files.""" |
| 80 # We want to check every text file, not just source files. | 82 # We want to check every text file, not just source files. |
| (...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 937 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( | 939 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( |
| 938 input_api, output_api)) | 940 input_api, output_api)) |
| 939 snapshot("checking license") | 941 snapshot("checking license") |
| 940 results.extend(input_api.canned_checks.CheckLicense( | 942 results.extend(input_api.canned_checks.CheckLicense( |
| 941 input_api, output_api, license_header, source_file_filter=sources)) | 943 input_api, output_api, license_header, source_file_filter=sources)) |
| 942 snapshot("checking was uploaded") | 944 snapshot("checking was uploaded") |
| 943 results.extend(input_api.canned_checks.CheckChangeWasUploaded( | 945 results.extend(input_api.canned_checks.CheckChangeWasUploaded( |
| 944 input_api, output_api)) | 946 input_api, output_api)) |
| 945 snapshot("done") | 947 snapshot("done") |
| 946 return results | 948 return results |
| OLD | NEW |