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 |
11 UNIT_TESTS = [ | 11 UNIT_TESTS = [ |
12 'tests.gcl_unittest', | 12 'tests.gcl_unittest', |
13 'tests.gclient_scm_test', | 13 'tests.gclient_scm_test', |
14 'tests.gclient_smoketest', | 14 'tests.gclient_smoketest', |
15 'tests.gclient_utils_test', | 15 'tests.gclient_utils_test', |
16 'tests.owners_unittest', | 16 'tests.owners_unittest', |
17 'tests.presubmit_unittest', | 17 'tests.presubmit_unittest', |
18 'tests.scm_unittest', | 18 'tests.scm_unittest', |
19 'tests.trychange_unittest', | 19 'tests.trychange_unittest', |
20 'tests.watchlists_unittest', | 20 'tests.watchlists_unittest', |
21 ] | 21 ] |
22 | 22 |
| 23 |
23 def CommonChecks(input_api, output_api): | 24 def CommonChecks(input_api, output_api): |
24 output = [] | 25 output = [] |
25 # Verify that LocalPath() is local, e.g.: | 26 # Verify that LocalPath() is local, e.g.: |
26 # os.path.join(PresubmitLocalPath(), LocalPath()) == AbsoluteLocalPath() | 27 # os.path.join(PresubmitLocalPath(), LocalPath()) == AbsoluteLocalPath() |
27 for i in input_api.AffectedFiles(): | 28 for i in input_api.AffectedFiles(): |
28 if (input_api.os_path.join(input_api.PresubmitLocalPath(), i.LocalPath()) != | 29 if (input_api.os_path.join(input_api.PresubmitLocalPath(), i.LocalPath()) != |
29 i.AbsoluteLocalPath()): | 30 i.AbsoluteLocalPath()): |
30 output.append(output_api.PresubmitError('Path inconsistency')) | 31 output.append(output_api.PresubmitError('Path inconsistency')) |
31 # Return right away because it needs to be fixed first. | 32 # Return right away because it needs to be fixed first. |
32 return output | 33 return output |
33 | 34 |
34 output.extend(input_api.canned_checks.CheckOwners( | 35 # TODO(dpranke): uncomment and enable :). |
35 input_api, | 36 # |
36 output_api)) | 37 # output.extend(input_api.canned_checks.CheckOwners( |
| 38 # input_api, |
| 39 # output_api)) |
37 | 40 |
38 output.extend(input_api.canned_checks.RunPythonUnitTests( | 41 output.extend(input_api.canned_checks.RunPythonUnitTests( |
39 input_api, | 42 input_api, |
40 output_api, | 43 output_api, |
41 UNIT_TESTS)) | 44 UNIT_TESTS)) |
42 output.extend(WasGitClUploadHookModified(input_api, output_api)) | 45 output.extend(WasGitClUploadHookModified(input_api, output_api)) |
43 | 46 |
44 white_list = [r'.*\.py$', r'^git-try$'] | 47 white_list = [r'.*\.py$', r'^git-try$'] |
45 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ | 48 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ |
46 r'^cpplint\.py$', | 49 r'^cpplint\.py$', |
(...skipping 22 matching lines...) Expand all Loading... |
69 | 72 |
70 | 73 |
71 def WasGitClUploadHookModified(input_api, output_api): | 74 def WasGitClUploadHookModified(input_api, output_api): |
72 for affected_file in input_api.AffectedSourceFiles(None): | 75 for affected_file in input_api.AffectedSourceFiles(None): |
73 if (input_api.os_path.basename(affected_file.LocalPath()) == | 76 if (input_api.os_path.basename(affected_file.LocalPath()) == |
74 'git-cl-upload-hook'): | 77 'git-cl-upload-hook'): |
75 return [output_api.PresubmitPromptWarning( | 78 return [output_api.PresubmitPromptWarning( |
76 'Don\'t forget to fix git-cl to download the newest version of ' | 79 'Don\'t forget to fix git-cl to download the newest version of ' |
77 'git-cl-upload-hook')] | 80 'git-cl-upload-hook')] |
78 return [] | 81 return [] |
OLD | NEW |