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 """\ | 6 """\ |
7 Wrapper script around Rietveld's upload.py that simplifies working with groups | 7 Wrapper script around Rietveld's upload.py that simplifies working with groups |
8 of files. | 8 of files. |
9 """ | 9 """ |
10 | 10 |
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 """Imports presubmit, then calls presubmit.DoPresubmitChecks.""" | 1162 """Imports presubmit, then calls presubmit.DoPresubmitChecks.""" |
1163 # Need to import here to avoid circular dependency. | 1163 # Need to import here to avoid circular dependency. |
1164 import presubmit_support | 1164 import presubmit_support |
1165 root_presubmit = GetCachedFile('PRESUBMIT.py', use_root=True) | 1165 root_presubmit = GetCachedFile('PRESUBMIT.py', use_root=True) |
1166 change = presubmit_support.SvnChange(change_info.name, | 1166 change = presubmit_support.SvnChange(change_info.name, |
1167 change_info.description, | 1167 change_info.description, |
1168 change_info.GetLocalRoot(), | 1168 change_info.GetLocalRoot(), |
1169 change_info.GetFiles(), | 1169 change_info.GetFiles(), |
1170 change_info.issue, | 1170 change_info.issue, |
1171 change_info.patchset) | 1171 change_info.patchset) |
1172 result = presubmit_support.DoPresubmitChecks(change=change, | 1172 output = presubmit_support.DoPresubmitChecks(change=change, |
1173 committing=committing, | 1173 committing=committing, |
1174 verbose=False, | 1174 verbose=False, |
1175 output_stream=sys.stdout, | 1175 output_stream=sys.stdout, |
1176 input_stream=sys.stdin, | 1176 input_stream=sys.stdin, |
1177 default_presubmit=root_presubmit, | 1177 default_presubmit=root_presubmit, |
1178 may_prompt=may_prompt) | 1178 may_prompt=may_prompt) |
1179 if not result and may_prompt: | 1179 if not output.should_continue() and may_prompt: |
| 1180 # TODO(dpranke): move into DoPresubmitChecks(), unify cmd line args. |
1180 print "\nPresubmit errors, can't continue (use --no_presubmit to bypass)" | 1181 print "\nPresubmit errors, can't continue (use --no_presubmit to bypass)" |
1181 return result | 1182 |
| 1183 # TODO(dpranke): Return the output object and make use of it. |
| 1184 return output.should_continue() |
1182 | 1185 |
1183 | 1186 |
1184 @no_args | 1187 @no_args |
1185 def CMDchanges(): | 1188 def CMDchanges(): |
1186 """Lists all the changelists and their files.""" | 1189 """Lists all the changelists and their files.""" |
1187 for cl in GetCLs(): | 1190 for cl in GetCLs(): |
1188 change_info = ChangeInfo.Load(cl, GetRepositoryRoot(), True, True) | 1191 change_info = ChangeInfo.Load(cl, GetRepositoryRoot(), True, True) |
1189 print "\n--- Changelist " + change_info.name + ":" | 1192 print "\n--- Changelist " + change_info.name + ":" |
1190 for filename in change_info.GetFiles(): | 1193 for filename in change_info.GetFiles(): |
1191 print "".join(filename) | 1194 print "".join(filename) |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 if e.code != 500: | 1398 if e.code != 500: |
1396 raise | 1399 raise |
1397 print >> sys.stderr, ( | 1400 print >> sys.stderr, ( |
1398 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1401 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
1399 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1402 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
1400 return 1 | 1403 return 1 |
1401 | 1404 |
1402 | 1405 |
1403 if __name__ == "__main__": | 1406 if __name__ == "__main__": |
1404 sys.exit(main(sys.argv[1:])) | 1407 sys.exit(main(sys.argv[1:])) |
OLD | NEW |