| 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 """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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 if options.proxy: | 321 if options.proxy: |
| 322 if options.proxy.lower() == 'none': | 322 if options.proxy.lower() == 'none': |
| 323 # Effectively disable HTTP_PROXY or Internet settings proxy setup. | 323 # Effectively disable HTTP_PROXY or Internet settings proxy setup. |
| 324 proxies = {} | 324 proxies = {} |
| 325 else: | 325 else: |
| 326 proxies = {'http': options.proxy, 'https': options.proxy} | 326 proxies = {'http': options.proxy, 'https': options.proxy} |
| 327 | 327 |
| 328 logging.info('Sending by HTTP') | 328 logging.info('Sending by HTTP') |
| 329 logging.info(description) | 329 logging.info(description) |
| 330 logging.info(url) | 330 logging.info(url) |
| 331 if options.dry_run: |
| 332 print options.diff |
| 333 return |
| 331 logging.info(options.diff) | 334 logging.info(options.diff) |
| 332 if options.dry_run: | |
| 333 return | |
| 334 | 335 |
| 335 try: | 336 try: |
| 336 connection = urllib.urlopen(url, urllib.urlencode(values), proxies=proxies) | 337 connection = urllib.urlopen(url, urllib.urlencode(values), proxies=proxies) |
| 337 except IOError, e: | 338 except IOError, e: |
| 338 logging.warning(str(e)) | 339 logging.warning(str(e)) |
| 339 if (values.get('bot') and len(e.args) > 2 and | 340 if (values.get('bot') and len(e.args) > 2 and |
| 340 e.args[2] == 'got a bad status line'): | 341 e.args[2] == 'got a bad status line'): |
| 341 raise NoTryServerAccess('%s is unaccessible. Bad --bot argument?' % url) | 342 raise NoTryServerAccess('%s is unaccessible. Bad --bot argument?' % url) |
| 342 else: | 343 else: |
| 343 raise NoTryServerAccess('%s is unaccessible. Reason: %s' % (url, | 344 raise NoTryServerAccess('%s is unaccessible. Reason: %s' % (url, |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 except (InvalidScript, NoTryServerAccess), e: | 746 except (InvalidScript, NoTryServerAccess), e: |
| 746 if swallow_exception: | 747 if swallow_exception: |
| 747 return 1 | 748 return 1 |
| 748 print e | 749 print e |
| 749 return 1 | 750 return 1 |
| 750 return 0 | 751 return 0 |
| 751 | 752 |
| 752 | 753 |
| 753 if __name__ == "__main__": | 754 if __name__ == "__main__": |
| 754 sys.exit(TryChange(None, [], False)) | 755 sys.exit(TryChange(None, [], False)) |
| OLD | NEW |