| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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.8.0' | 9 __version__ = '1.8.0' |
| 10 | 10 |
| (...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 default_presubmit: A default presubmit script to execute in any case. | 1126 default_presubmit: A default presubmit script to execute in any case. |
| 1127 project: Optional name of a project used in selecting trybots. | 1127 project: Optional name of a project used in selecting trybots. |
| 1128 verbose: Prints debug info. | 1128 verbose: Prints debug info. |
| 1129 output_stream: A stream to write debug output to. | 1129 output_stream: A stream to write debug output to. |
| 1130 | 1130 |
| 1131 Return: | 1131 Return: |
| 1132 List of try slaves | 1132 List of try slaves |
| 1133 """ | 1133 """ |
| 1134 presubmit_files = ListRelevantPresubmitFiles(changed_files, repository_root) | 1134 presubmit_files = ListRelevantPresubmitFiles(changed_files, repository_root) |
| 1135 if not presubmit_files and verbose: | 1135 if not presubmit_files and verbose: |
| 1136 output_stream.write("Warning, no presubmit.py found.\n") | 1136 output_stream.write("Warning, no PRESUBMIT.py found.\n") |
| 1137 results = [] | 1137 results = [] |
| 1138 executer = GetTrySlavesExecuter() | 1138 executer = GetTrySlavesExecuter() |
| 1139 | 1139 |
| 1140 if default_presubmit: | 1140 if default_presubmit: |
| 1141 if verbose: | 1141 if verbose: |
| 1142 output_stream.write("Running default presubmit script.\n") | 1142 output_stream.write("Running default presubmit script.\n") |
| 1143 fake_path = os.path.join(repository_root, 'PRESUBMIT.py') | 1143 fake_path = os.path.join(repository_root, 'PRESUBMIT.py') |
| 1144 results.extend(executer.ExecPresubmitScript( | 1144 results.extend(executer.ExecPresubmitScript( |
| 1145 default_presubmit, fake_path, project, change)) | 1145 default_presubmit, fake_path, project, change)) |
| 1146 for filename in presubmit_files: | 1146 for filename in presubmit_files: |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1607 except PresubmitFailure, e: | 1607 except PresubmitFailure, e: |
| 1608 print >> sys.stderr, e | 1608 print >> sys.stderr, e |
| 1609 print >> sys.stderr, 'Maybe your depot_tools is out of date?' | 1609 print >> sys.stderr, 'Maybe your depot_tools is out of date?' |
| 1610 print >> sys.stderr, 'If all fails, contact maruel@' | 1610 print >> sys.stderr, 'If all fails, contact maruel@' |
| 1611 return 2 | 1611 return 2 |
| 1612 | 1612 |
| 1613 | 1613 |
| 1614 if __name__ == '__main__': | 1614 if __name__ == '__main__': |
| 1615 fix_encoding.fix_encoding() | 1615 fix_encoding.fix_encoding() |
| 1616 sys.exit(Main(None)) | 1616 sys.exit(Main(None)) |
| OLD | NEW |