OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Enables directory-specific presubmit checks to run at upload and/or commit. | 6 """Enables directory-specific presubmit checks to run at upload and/or commit. |
7 """ | 7 """ |
8 | 8 |
9 __version__ = '1.6.1' | 9 __version__ = '1.6.1' |
10 | 10 |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 | 1068 |
1069 output = PresubmitOutput(input_stream, output_stream) | 1069 output = PresubmitOutput(input_stream, output_stream) |
1070 if committing: | 1070 if committing: |
1071 output.write("Running presubmit commit checks ...\n") | 1071 output.write("Running presubmit commit checks ...\n") |
1072 else: | 1072 else: |
1073 output.write("Running presubmit upload checks ...\n") | 1073 output.write("Running presubmit upload checks ...\n") |
1074 start_time = time.time() | 1074 start_time = time.time() |
1075 presubmit_files = ListRelevantPresubmitFiles( | 1075 presubmit_files = ListRelevantPresubmitFiles( |
1076 change.AbsoluteLocalPaths(True), change.RepositoryRoot()) | 1076 change.AbsoluteLocalPaths(True), change.RepositoryRoot()) |
1077 if not presubmit_files and verbose: | 1077 if not presubmit_files and verbose: |
1078 output.write("Warning, no presubmit.py found.\n") | 1078 output.write("Warning, no PRESUBMIT.py found.\n") |
1079 results = [] | 1079 results = [] |
1080 executer = PresubmitExecuter(change, committing, rietveld_obj, verbose) | 1080 executer = PresubmitExecuter(change, committing, rietveld_obj, verbose) |
1081 if default_presubmit: | 1081 if default_presubmit: |
1082 if verbose: | 1082 if verbose: |
1083 output.write("Running default presubmit script.\n") | 1083 output.write("Running default presubmit script.\n") |
1084 fake_path = os.path.join(change.RepositoryRoot(), 'PRESUBMIT.py') | 1084 fake_path = os.path.join(change.RepositoryRoot(), 'PRESUBMIT.py') |
1085 results += executer.ExecPresubmitScript(default_presubmit, fake_path) | 1085 results += executer.ExecPresubmitScript(default_presubmit, fake_path) |
1086 for filename in presubmit_files: | 1086 for filename in presubmit_files: |
1087 filename = os.path.abspath(filename) | 1087 filename = os.path.abspath(filename) |
1088 if verbose: | 1088 if verbose: |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 except PresubmitFailure, e: | 1246 except PresubmitFailure, e: |
1247 print >> sys.stderr, e | 1247 print >> sys.stderr, e |
1248 print >> sys.stderr, 'Maybe your depot_tools is out of date?' | 1248 print >> sys.stderr, 'Maybe your depot_tools is out of date?' |
1249 print >> sys.stderr, 'If all fails, contact maruel@' | 1249 print >> sys.stderr, 'If all fails, contact maruel@' |
1250 return 2 | 1250 return 2 |
1251 | 1251 |
1252 | 1252 |
1253 if __name__ == '__main__': | 1253 if __name__ == '__main__': |
1254 fix_encoding.fix_encoding() | 1254 fix_encoding.fix_encoding() |
1255 sys.exit(Main(None)) | 1255 sys.exit(Main(None)) |
OLD | NEW |