OLD | NEW |
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 | 5 |
6 """Client-side script to send a try job to the try server. It communicates to | 6 """Client-side script to send a try job to the try server. It communicates to |
7 the try server by either writting to a svn repository or by directly connecting | 7 the try server by either writting to a svn repository or by directly connecting |
8 to the server by HTTP. | 8 to the server by HTTP. |
9 """ | 9 """ |
10 | 10 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 329 |
330 logging.info('Sending by HTTP') | 330 logging.info('Sending by HTTP') |
331 logging.info(description) | 331 logging.info(description) |
332 logging.info(url) | 332 logging.info(url) |
333 if options.dry_run: | 333 if options.dry_run: |
334 print options.diff | 334 print options.diff |
335 return | 335 return |
336 logging.info(options.diff) | 336 logging.info(options.diff) |
337 | 337 |
338 try: | 338 try: |
| 339 logging.info('Opening connection...') |
339 connection = urllib.urlopen(url, urllib.urlencode(values), proxies=proxies) | 340 connection = urllib.urlopen(url, urllib.urlencode(values), proxies=proxies) |
| 341 logging.info('Done') |
340 except IOError, e: | 342 except IOError, e: |
341 logging.info(str(e)) | 343 logging.info(str(e)) |
342 if (values.get('bot') and len(e.args) > 2 and | 344 if (values.get('bot') and len(e.args) > 2 and |
343 e.args[2] == 'got a bad status line'): | 345 e.args[2] == 'got a bad status line'): |
344 raise NoTryServerAccess('%s is unaccessible. Bad --bot argument?' % url) | 346 raise NoTryServerAccess('%s is unaccessible. Bad --bot argument?' % url) |
345 else: | 347 else: |
346 raise NoTryServerAccess('%s is unaccessible. Reason: %s' % (url, | 348 raise NoTryServerAccess('%s is unaccessible. Reason: %s' % (url, |
347 str(e.args))) | 349 str(e.args))) |
348 if not connection: | 350 if not connection: |
349 raise NoTryServerAccess('%s is unaccessible.' % url) | 351 raise NoTryServerAccess('%s is unaccessible.' % url) |
| 352 logging.info('Reading response...') |
350 response = connection.read() | 353 response = connection.read() |
| 354 logging.info('Done') |
351 if response != 'OK': | 355 if response != 'OK': |
352 raise NoTryServerAccess('%s is unaccessible. Got:\n%s' % (url, response)) | 356 raise NoTryServerAccess('%s is unaccessible. Got:\n%s' % (url, response)) |
353 | 357 |
354 | 358 |
355 def _SendChangeSVN(options): | 359 def _SendChangeSVN(options): |
356 """Send a change to the try server by committing a diff file on a subversion | 360 """Send a change to the try server by committing a diff file on a subversion |
357 server.""" | 361 server.""" |
358 if not options.svn_repo: | 362 if not options.svn_repo: |
359 raise NoTryServerAccess('Please use the --svn_repo option to specify the' | 363 raise NoTryServerAccess('Please use the --svn_repo option to specify the' |
360 ' try server svn repository to connect to.') | 364 ' try server svn repository to connect to.') |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 print >> sys.stderr, e | 769 print >> sys.stderr, e |
766 return 1 | 770 return 1 |
767 except gclient_utils.Error, e: | 771 except gclient_utils.Error, e: |
768 print >> sys.stderr, e | 772 print >> sys.stderr, e |
769 return 1 | 773 return 1 |
770 return 0 | 774 return 0 |
771 | 775 |
772 | 776 |
773 if __name__ == "__main__": | 777 if __name__ == "__main__": |
774 sys.exit(TryChange(None, [], False)) | 778 sys.exit(TryChange(None, [], False)) |
OLD | NEW |