| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 def IsFatal(self): | 147 def IsFatal(self): |
| 148 """An error that is fatal stops g4 mail/submit immediately, i.e. before | 148 """An error that is fatal stops g4 mail/submit immediately, i.e. before |
| 149 other presubmit scripts are run. | 149 other presubmit scripts are run. |
| 150 """ | 150 """ |
| 151 return False | 151 return False |
| 152 | 152 |
| 153 def ShouldPrompt(self): | 153 def ShouldPrompt(self): |
| 154 """Whether this presubmit result should result in a prompt warning.""" | 154 """Whether this presubmit result should result in a prompt warning.""" |
| 155 return False | 155 return False |
| 156 | 156 |
| 157 class PresubmitAddText(PresubmitResult): |
| 158 """Propagates a line of text back to the caller.""" |
| 159 def __init__(self, message, items=None, long_text=''): |
| 160 super(OutputApi.PresubmitAddText, self).__init__("ADD: " + message, |
| 161 items, long_text) |
| 162 |
| 157 class PresubmitError(PresubmitResult): | 163 class PresubmitError(PresubmitResult): |
| 158 """A hard presubmit error.""" | 164 """A hard presubmit error.""" |
| 159 def IsFatal(self): | 165 def IsFatal(self): |
| 160 return True | 166 return True |
| 161 | 167 |
| 162 class PresubmitPromptWarning(PresubmitResult): | 168 class PresubmitPromptWarning(PresubmitResult): |
| 163 """An warning that prompts the user if they want to continue.""" | 169 """An warning that prompts the user if they want to continue.""" |
| 164 def ShouldPrompt(self): | 170 def ShouldPrompt(self): |
| 165 return True | 171 return True |
| 166 | 172 |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 options.commit, | 1174 options.commit, |
| 1169 options.verbose, | 1175 options.verbose, |
| 1170 sys.stdout, | 1176 sys.stdout, |
| 1171 sys.stdin, | 1177 sys.stdin, |
| 1172 options.default_presubmit, | 1178 options.default_presubmit, |
| 1173 options.may_prompt) | 1179 options.may_prompt) |
| 1174 | 1180 |
| 1175 | 1181 |
| 1176 if __name__ == '__main__': | 1182 if __name__ == '__main__': |
| 1177 sys.exit(Main(sys.argv)) | 1183 sys.exit(Main(sys.argv)) |
| OLD | NEW |