OLD | NEW |
1 # Copyright (c) 2009 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 """Top-level presubmit script for depot tools. | 5 """Top-level presubmit script for depot tools. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
8 details on the presubmit API built into gcl. | 8 details on the presubmit API built into gcl. |
9 """ | 9 """ |
10 | 10 |
11 UNIT_TESTS = [ | 11 UNIT_TESTS = [ |
(...skipping 10 matching lines...) Expand all Loading... |
22 def CommonChecks(input_api, output_api): | 22 def CommonChecks(input_api, output_api): |
23 output = [] | 23 output = [] |
24 output.extend(input_api.canned_checks.RunPythonUnitTests( | 24 output.extend(input_api.canned_checks.RunPythonUnitTests( |
25 input_api, | 25 input_api, |
26 output_api, | 26 output_api, |
27 UNIT_TESTS)) | 27 UNIT_TESTS)) |
28 output.extend(WasGitClUploadHookModified(input_api, output_api)) | 28 output.extend(WasGitClUploadHookModified(input_api, output_api)) |
29 | 29 |
30 white_list = [r'.*\.py$', r'.*git-try$'] | 30 white_list = [r'.*\.py$', r'.*git-try$'] |
31 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ | 31 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ |
32 r'.*cpplint\.py$', r'.*git_cl_repo.*'] | 32 r'.*cpplint\.py$', r'.*git_cl\/.*'] |
33 output.extend(input_api.canned_checks.RunPylint( | 33 output.extend(input_api.canned_checks.RunPylint( |
34 input_api, | 34 input_api, |
35 output_api, | 35 output_api, |
36 white_list=white_list, | 36 white_list=white_list, |
37 black_list=black_list)) | 37 black_list=black_list)) |
38 return output | 38 return output |
39 | 39 |
40 | 40 |
41 def CheckChangeOnUpload(input_api, output_api): | 41 def CheckChangeOnUpload(input_api, output_api): |
42 return CommonChecks(input_api, output_api) | 42 return CommonChecks(input_api, output_api) |
43 | 43 |
44 | 44 |
45 def CheckChangeOnCommit(input_api, output_api): | 45 def CheckChangeOnCommit(input_api, output_api): |
46 output = [] | 46 output = [] |
47 output.extend(CommonChecks(input_api, output_api)) | 47 output.extend(CommonChecks(input_api, output_api)) |
48 output.extend(input_api.canned_checks.CheckDoNotSubmit( | 48 output.extend(input_api.canned_checks.CheckDoNotSubmit( |
49 input_api, | 49 input_api, |
50 output_api)) | 50 output_api)) |
51 return output | 51 return output |
52 | 52 |
53 | 53 |
54 def WasGitClUploadHookModified(input_api, output_api): | 54 def WasGitClUploadHookModified(input_api, output_api): |
55 for affected_file in input_api.AffectedSourceFiles(None): | 55 for affected_file in input_api.AffectedSourceFiles(None): |
56 if (input_api.os_path.basename(affected_file.LocalPath()) == | 56 if (input_api.os_path.basename(affected_file.LocalPath()) == |
57 'git-cl-upload-hook'): | 57 'git-cl-upload-hook'): |
58 return [output_api.PresubmitPromptWarning( | 58 return [output_api.PresubmitPromptWarning( |
59 'Don\'t forget to fix git-cl to download the newest version of ' | 59 'Don\'t forget to fix git-cl to download the newest version of ' |
60 'git-cl-upload-hook')] | 60 'git-cl-upload-hook')] |
61 return [] | 61 return [] |
OLD | NEW |