Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: trychange.py

Issue 507071: Prints errors on http protocol (Closed)
Patch Set: Created 10 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 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 """Client-side script to send a try job to the try server. It communicates to 5 """Client-side script to send a try job to the try server. It communicates to
6 the try server by either writting to a svn repository or by directly connecting 6 the try server by either writting to a svn repository or by directly connecting
7 to the server by HTTP. 7 to the server by HTTP.
8 """ 8 """
9 9
10 import datetime 10 import datetime
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 connection = urllib.urlopen(url, urllib.urlencode(values), proxies=proxies) 215 connection = urllib.urlopen(url, urllib.urlencode(values), proxies=proxies)
216 except IOError, e: 216 except IOError, e:
217 if (values.get('bot') and len(e.args) > 2 and 217 if (values.get('bot') and len(e.args) > 2 and
218 e.args[2] == 'got a bad status line'): 218 e.args[2] == 'got a bad status line'):
219 raise NoTryServerAccess('%s is unaccessible. Bad --bot argument?' % url) 219 raise NoTryServerAccess('%s is unaccessible. Bad --bot argument?' % url)
220 else: 220 else:
221 raise NoTryServerAccess('%s is unaccessible. Reason: %s' % (url, 221 raise NoTryServerAccess('%s is unaccessible. Reason: %s' % (url,
222 str(e.args))) 222 str(e.args)))
223 if not connection: 223 if not connection:
224 raise NoTryServerAccess('%s is unaccessible.' % url) 224 raise NoTryServerAccess('%s is unaccessible.' % url)
225 if connection.read() != 'OK': 225 response = connection.read()
226 raise NoTryServerAccess('%s is unaccessible.' % url) 226 if response != 'OK':
227 raise NoTryServerAccess('%s is unaccessible. Got:\n%s' % (url, response))
227 228
228 229
229 def _SendChangeSVN(options): 230 def _SendChangeSVN(options):
230 """Send a change to the try server by committing a diff file on a subversion 231 """Send a change to the try server by committing a diff file on a subversion
231 server.""" 232 server."""
232 if not options.svn_repo: 233 if not options.svn_repo:
233 raise NoTryServerAccess('Please use the --svn_repo option to specify the' 234 raise NoTryServerAccess('Please use the --svn_repo option to specify the'
234 ' try server svn repository to connect to.') 235 ' try server svn repository to connect to.')
235 236
236 values = _ParseSendChangeOptions(options) 237 values = _ParseSendChangeOptions(options)
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 print('Note: use --name NAME to change the try job name.') 487 print('Note: use --name NAME to change the try job name.')
487 if not options.email: 488 if not options.email:
488 print('Warning: TRYBOT_RESULTS_EMAIL_ADDRESS is not set. Try server ' 489 print('Warning: TRYBOT_RESULTS_EMAIL_ADDRESS is not set. Try server '
489 'results might\ngo to: %s@google.com.\n' % options.user) 490 'results might\ngo to: %s@google.com.\n' % options.user)
490 else: 491 else:
491 print('Results will be emailed to: ' + options.email) 492 print('Results will be emailed to: ' + options.email)
492 493
493 # Send the patch. 494 # Send the patch.
494 options.send_patch(options) 495 options.send_patch(options)
495 if not options.dry_run: 496 if not options.dry_run:
496 print 'Patch \'%s\' sent to try server: %s' % (options.name, 497 text = 'Patch \'%s\' sent to try server' % options.name
497 ', '.join(options.bot)) 498 if options.bot:
499 text += ': %s' % ', '.join(options.bot)
500 print(text)
498 except (InvalidScript, NoTryServerAccess), e: 501 except (InvalidScript, NoTryServerAccess), e:
499 if swallow_exception: 502 if swallow_exception:
500 return 1 503 return 1
501 print e 504 print e
502 return 1 505 return 1
503 return 0 506 return 0
504 507
505 508
506 if __name__ == "__main__": 509 if __name__ == "__main__":
507 sys.exit(TryChange(None, [], False)) 510 sys.exit(TryChange(None, [], False))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698