| OLD | NEW | 
|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python | 
| 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 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.1' | 9 __version__ = '1.1' | 
| 10 | 10 | 
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 654     verbose: Prints debug info. | 654     verbose: Prints debug info. | 
| 655     output_stream: A stream to write output from presubmit tests to. | 655     output_stream: A stream to write output from presubmit tests to. | 
| 656     input_stream: A stream to read input from the user. | 656     input_stream: A stream to read input from the user. | 
| 657     default_presubmit: A default presubmit script to execute in any case. | 657     default_presubmit: A default presubmit script to execute in any case. | 
| 658 | 658 | 
| 659   Return: | 659   Return: | 
| 660     True if execution can continue, False if not. | 660     True if execution can continue, False if not. | 
| 661   """ | 661   """ | 
| 662   presubmit_files = ListRelevantPresubmitFiles(change_info.FileList()) | 662   presubmit_files = ListRelevantPresubmitFiles(change_info.FileList()) | 
| 663   if not presubmit_files and verbose: | 663   if not presubmit_files and verbose: | 
| 664     output_stream.write("Warning, no presubmit.py found.") | 664     output_stream.write("Warning, no presubmit.py found.\n") | 
| 665   results = [] | 665   results = [] | 
| 666   executer = PresubmitExecuter(change_info, committing) | 666   executer = PresubmitExecuter(change_info, committing) | 
| 667   if default_presubmit: | 667   if default_presubmit: | 
| 668     if verbose: | 668     if verbose: | 
| 669       output_stream.write("Running default presubmit script") | 669       output_stream.write("Running default presubmit script.\n") | 
| 670     results += executer.ExecPresubmitScript(default_presubmit, 'PRESUBMIT.py') | 670     results += executer.ExecPresubmitScript(default_presubmit, 'PRESUBMIT.py') | 
| 671   for filename in presubmit_files: | 671   for filename in presubmit_files: | 
| 672     filename = os.path.abspath(filename) | 672     filename = os.path.abspath(filename) | 
| 673     if verbose: | 673     if verbose: | 
| 674       output_stream.write("Running %s" % filename) | 674       output_stream.write("Running %s\n" % filename) | 
| 675     # Accept CRLF presubmit script. | 675     # Accept CRLF presubmit script. | 
| 676     presubmit_script = gcl.ReadFile(filename, 'rU') | 676     presubmit_script = gcl.ReadFile(filename, 'rU') | 
| 677     results += executer.ExecPresubmitScript(presubmit_script, filename) | 677     results += executer.ExecPresubmitScript(presubmit_script, filename) | 
| 678 | 678 | 
| 679   errors = [] | 679   errors = [] | 
| 680   notifications = [] | 680   notifications = [] | 
| 681   warnings = [] | 681   warnings = [] | 
| 682   for result in results: | 682   for result in results: | 
| 683     if not result.IsFatal() and not result.ShouldPrompt(): | 683     if not result.IsFatal() and not result.ShouldPrompt(): | 
| 684       notifications.append(result) | 684       notifications.append(result) | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 744   return not DoPresubmitChecks(gcl.ChangeInfo(name='temp', files=files), | 744   return not DoPresubmitChecks(gcl.ChangeInfo(name='temp', files=files), | 
| 745                                options.commit, | 745                                options.commit, | 
| 746                                options.verbose, | 746                                options.verbose, | 
| 747                                sys.stdout, | 747                                sys.stdout, | 
| 748                                sys.stdin, | 748                                sys.stdin, | 
| 749                                default_presubmit=None) | 749                                default_presubmit=None) | 
| 750 | 750 | 
| 751 | 751 | 
| 752 if __name__ == '__main__': | 752 if __name__ == '__main__': | 
| 753   sys.exit(Main(sys.argv)) | 753   sys.exit(Main(sys.argv)) | 
| OLD | NEW | 
|---|