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.3.2' | 9 __version__ = '1.3.2' |
10 | 10 |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 for name, items in (('Messages', notifications), | 760 for name, items in (('Messages', notifications), |
761 ('Warnings', warnings), | 761 ('Warnings', warnings), |
762 ('ERRORS', errors)): | 762 ('ERRORS', errors)): |
763 if items: | 763 if items: |
764 output_stream.write('** Presubmit %s **\n' % name) | 764 output_stream.write('** Presubmit %s **\n' % name) |
765 for item in items: | 765 for item in items: |
766 if not item._Handle(output_stream, input_stream, | 766 if not item._Handle(output_stream, input_stream, |
767 may_prompt=False): | 767 may_prompt=False): |
768 error_count += 1 | 768 error_count += 1 |
769 output_stream.write('\n') | 769 output_stream.write('\n') |
770 if not errors and warnings: | 770 if not errors and warnings and may_prompt: |
771 output_stream.write( | 771 output_stream.write( |
772 'There were presubmit warnings. Sure you want to continue? (y/N): ') | 772 'There were presubmit warnings. Sure you want to continue? (y/N): ') |
773 response = input_stream.readline() | 773 response = input_stream.readline() |
774 if response.strip().lower() != 'y': | 774 if response.strip().lower() != 'y': |
775 error_count += 1 | 775 error_count += 1 |
776 return (error_count == 0) | 776 return (error_count == 0) |
777 | 777 |
778 | 778 |
779 def ScanSubDirs(mask, recursive): | 779 def ScanSubDirs(mask, recursive): |
780 if not recursive: | 780 if not recursive: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 options.commit, | 814 options.commit, |
815 options.verbose, | 815 options.verbose, |
816 sys.stdout, | 816 sys.stdout, |
817 sys.stdin, | 817 sys.stdin, |
818 None, | 818 None, |
819 False) | 819 False) |
820 | 820 |
821 | 821 |
822 if __name__ == '__main__': | 822 if __name__ == '__main__': |
823 sys.exit(Main(sys.argv)) | 823 sys.exit(Main(sys.argv)) |
OLD | NEW |