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 """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 |
(...skipping 24 matching lines...) Expand all Loading... |
35 # TODO(dpranke): uncomment and enable :). | 35 # TODO(dpranke): uncomment and enable :). |
36 # | 36 # |
37 # output.extend(input_api.canned_checks.CheckOwners( | 37 # output.extend(input_api.canned_checks.CheckOwners( |
38 # input_api, | 38 # input_api, |
39 # output_api)) | 39 # output_api)) |
40 | 40 |
41 output.extend(input_api.canned_checks.RunPythonUnitTests( | 41 output.extend(input_api.canned_checks.RunPythonUnitTests( |
42 input_api, | 42 input_api, |
43 output_api, | 43 output_api, |
44 UNIT_TESTS)) | 44 UNIT_TESTS)) |
45 output.extend(WasGitClUploadHookModified(input_api, output_api)) | |
46 | 45 |
47 white_list = [r'.*\.py$', r'^git-try$'] | 46 white_list = [r'.*\.py$', r'^git-try$'] |
48 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ | 47 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ |
49 r'^cpplint\.py$', | 48 r'^cpplint\.py$', |
50 r'^git_cl[\/\\].*', | 49 r'^git_cl[\/\\]test[\/\\](local_)?rietveld.*', |
51 r'^git_cl_repo[\/\\].*', | 50 r'^git_cl[\/\\]upload.*', |
52 r'^git_cl[\/\\]test[\/\\]rietveld.*'] | 51 ] |
53 output.extend(input_api.canned_checks.RunPylint( | 52 output.extend(input_api.canned_checks.RunPylint( |
54 input_api, | 53 input_api, |
55 output_api, | 54 output_api, |
56 white_list=white_list, | 55 white_list=white_list, |
57 black_list=black_list)) | 56 black_list=black_list)) |
58 return output | 57 return output |
59 | 58 |
60 | 59 |
61 def CheckChangeOnUpload(input_api, output_api): | 60 def CheckChangeOnUpload(input_api, output_api): |
62 return CommonChecks(input_api, output_api) | 61 return CommonChecks(input_api, output_api) |
63 | 62 |
64 | 63 |
65 def CheckChangeOnCommit(input_api, output_api): | 64 def CheckChangeOnCommit(input_api, output_api): |
66 output = [] | 65 output = [] |
67 output.extend(CommonChecks(input_api, output_api)) | 66 output.extend(CommonChecks(input_api, output_api)) |
68 output.extend(input_api.canned_checks.CheckDoNotSubmit( | 67 output.extend(input_api.canned_checks.CheckDoNotSubmit( |
69 input_api, | 68 input_api, |
70 output_api)) | 69 output_api)) |
71 return output | 70 return output |
72 | |
73 | |
74 def WasGitClUploadHookModified(input_api, output_api): | |
75 for affected_file in input_api.AffectedSourceFiles(None): | |
76 if (input_api.os_path.basename(affected_file.LocalPath()) == | |
77 'git-cl-upload-hook'): | |
78 return [output_api.PresubmitPromptWarning( | |
79 'Don\'t forget to fix git-cl to download the newest version of ' | |
80 'git-cl-upload-hook')] | |
81 return [] | |
OLD | NEW |