Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: PRESUBMIT.py

Issue 6004006: Fix path filtering to be on the relative path and no on the absolute path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Make pylint failure on commit an error. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | presubmit_canned_checks.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2009 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.presubmit_unittest', 16 'tests.presubmit_unittest',
17 'tests.scm_unittest', 17 'tests.scm_unittest',
18 'tests.trychange_unittest', 18 'tests.trychange_unittest',
19 'tests.watchlists_unittest', 19 'tests.watchlists_unittest',
20 ] 20 ]
21 21
22 def CommonChecks(input_api, output_api): 22 def CommonChecks(input_api, output_api):
23 output = [] 23 output = []
24 # Verify that LocalPath() is local.
25 for i in input_api.AffectedFiles():
26 if (input_api.os_path.join(input_api.PresubmitLocalPath(), i.LocalPath()) !=
27 i.AbsoluteLocalPath()):
28 output.append(output_api.PresubmitError('Path inconsistency'))
nsylvain 2010/12/23 22:12:00 Do you have an example of failure here? When can t
M-A Ruel 2010/12/23 23:49:53 PresubmitLocalPath() = /home/foo/src LocalPath() =
29 # Return right away because it needs to be fixed first.
30 return output
31
24 output.extend(input_api.canned_checks.RunPythonUnitTests( 32 output.extend(input_api.canned_checks.RunPythonUnitTests(
25 input_api, 33 input_api,
26 output_api, 34 output_api,
27 UNIT_TESTS)) 35 UNIT_TESTS))
28 output.extend(WasGitClUploadHookModified(input_api, output_api)) 36 output.extend(WasGitClUploadHookModified(input_api, output_api))
29 37
30 white_list = [r'.*\.py$', r'.*git-try$'] 38 white_list = [r'.*\.py$', r'^git-try$']
31 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ 39 black_list = list(input_api.DEFAULT_BLACK_LIST) + [
32 r'.*cpplint\.py$', r'.*git_cl_repo.*'] 40 r'^cpplint\.py$',
41 r'^git_cl[\/\\].*',
42 r'^git_cl_repo[\/\\].*',
43 r'^git_cl[\/\\]test[\/\\]rietveld.*']
33 output.extend(input_api.canned_checks.RunPylint( 44 output.extend(input_api.canned_checks.RunPylint(
34 input_api, 45 input_api,
35 output_api, 46 output_api,
36 white_list=white_list, 47 white_list=white_list,
37 black_list=black_list)) 48 black_list=black_list))
38 return output 49 return output
39 50
40 51
41 def CheckChangeOnUpload(input_api, output_api): 52 def CheckChangeOnUpload(input_api, output_api):
42 return CommonChecks(input_api, output_api) 53 return CommonChecks(input_api, output_api)
43 54
44 55
45 def CheckChangeOnCommit(input_api, output_api): 56 def CheckChangeOnCommit(input_api, output_api):
46 output = [] 57 output = []
47 output.extend(CommonChecks(input_api, output_api)) 58 output.extend(CommonChecks(input_api, output_api))
48 output.extend(input_api.canned_checks.CheckDoNotSubmit( 59 output.extend(input_api.canned_checks.CheckDoNotSubmit(
49 input_api, 60 input_api,
50 output_api)) 61 output_api))
51 return output 62 return output
52 63
53 64
54 def WasGitClUploadHookModified(input_api, output_api): 65 def WasGitClUploadHookModified(input_api, output_api):
55 for affected_file in input_api.AffectedSourceFiles(None): 66 for affected_file in input_api.AffectedSourceFiles(None):
56 if (input_api.os_path.basename(affected_file.LocalPath()) == 67 if (input_api.os_path.basename(affected_file.LocalPath()) ==
57 'git-cl-upload-hook'): 68 'git-cl-upload-hook'):
58 return [output_api.PresubmitPromptWarning( 69 return [output_api.PresubmitPromptWarning(
59 'Don\'t forget to fix git-cl to download the newest version of ' 70 'Don\'t forget to fix git-cl to download the newest version of '
60 'git-cl-upload-hook')] 71 'git-cl-upload-hook')]
61 return [] 72 return []
OLDNEW
« no previous file with comments | « no previous file | presubmit_canned_checks.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698