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.5' | 9 __version__ = '1.3.5' |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 Returns: | 109 Returns: |
110 True if execution may continue, False otherwise. | 110 True if execution may continue, False otherwise. |
111 """ | 111 """ |
112 output_stream.write(self._message) | 112 output_stream.write(self._message) |
113 output_stream.write('\n') | 113 output_stream.write('\n') |
114 if len(self._items) > 0: | 114 if len(self._items) > 0: |
115 output_stream.write(' ' + ' \\\n '.join(map(str, self._items)) + '\n') | 115 output_stream.write(' ' + ' \\\n '.join(map(str, self._items)) + '\n') |
116 if self._long_text: | 116 if self._long_text: |
117 output_stream.write('\n***************\n%s\n***************\n' % | 117 output_stream.write('\n***************\n%s\n***************\n' % |
118 self._long_text.encode('ascii', 'replace')) | 118 self._long_text) |
119 | 119 |
120 if self.ShouldPrompt() and may_prompt: | 120 if self.ShouldPrompt() and may_prompt: |
121 if not PromptYesNo(input_stream, output_stream, | 121 if not PromptYesNo(input_stream, output_stream, |
122 'Are you sure you want to continue? (y/N): '): | 122 'Are you sure you want to continue? (y/N): '): |
123 return False | 123 return False |
124 | 124 |
125 return not self.IsFatal() | 125 return not self.IsFatal() |
126 | 126 |
127 def IsFatal(self): | 127 def IsFatal(self): |
128 """An error that is fatal stops g4 mail/submit immediately, i.e. before | 128 """An error that is fatal stops g4 mail/submit immediately, i.e. before |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 options.commit, | 1087 options.commit, |
1088 options.verbose, | 1088 options.verbose, |
1089 sys.stdout, | 1089 sys.stdout, |
1090 sys.stdin, | 1090 sys.stdin, |
1091 options.default_presubmit, | 1091 options.default_presubmit, |
1092 options.may_prompt) | 1092 options.may_prompt) |
1093 | 1093 |
1094 | 1094 |
1095 if __name__ == '__main__': | 1095 if __name__ == '__main__': |
1096 sys.exit(Main(sys.argv)) | 1096 sys.exit(Main(sys.argv)) |
OLD | NEW |