| 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 swallow_exception, | 451 swallow_exception, |
| 452 prog=None, | 452 prog=None, |
| 453 extra_epilog=None): | 453 extra_epilog=None): |
| 454 """ | 454 """ |
| 455 Args: | 455 Args: |
| 456 argv: Arguments and options. | 456 argv: Arguments and options. |
| 457 file_list: Default value to pass to --file. | 457 file_list: Default value to pass to --file. |
| 458 swallow_exception: Whether we raise or swallow exceptions. | 458 swallow_exception: Whether we raise or swallow exceptions. |
| 459 """ | 459 """ |
| 460 # Parse argv | 460 # Parse argv |
| 461 parser = optparse.OptionParser(usage=USAGE, |
| 462 version=__version__, |
| 463 prog=prog) |
| 461 epilog = EPILOG % { 'prog': prog } | 464 epilog = EPILOG % { 'prog': prog } |
| 462 if extra_epilog: | 465 if extra_epilog: |
| 463 epilog += extra_epilog | 466 epilog += extra_epilog |
| 464 parser = optparse.OptionParser(usage=USAGE, | 467 parser.epilog = epilog |
| 465 version=__version__, | |
| 466 prog=prog, | |
| 467 epilog=epilog) | |
| 468 # Remove epilog formatting | 468 # Remove epilog formatting |
| 469 parser.format_epilog = lambda x: parser.epilog | 469 parser.format_epilog = lambda x: parser.epilog |
| 470 parser.add_option("-v", "--verbose", action="count", default=0, | 470 parser.add_option("-v", "--verbose", action="count", default=0, |
| 471 help="Prints debugging infos") | 471 help="Prints debugging infos") |
| 472 group = optparse.OptionGroup(parser, "Result and status") | 472 group = optparse.OptionGroup(parser, "Result and status") |
| 473 group.add_option("-u", "--user", default=getpass.getuser(), | 473 group.add_option("-u", "--user", default=getpass.getuser(), |
| 474 help="Owner user name [default: %default]") | 474 help="Owner user name [default: %default]") |
| 475 group.add_option("-e", "--email", | 475 group.add_option("-e", "--email", |
| 476 default=os.environ.get('TRYBOT_RESULTS_EMAIL_ADDRESS', | 476 default=os.environ.get('TRYBOT_RESULTS_EMAIL_ADDRESS', |
| 477 os.environ.get('EMAIL_ADDRESS')), | 477 os.environ.get('EMAIL_ADDRESS')), |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 except (InvalidScript, NoTryServerAccess), e: | 735 except (InvalidScript, NoTryServerAccess), e: |
| 736 if swallow_exception: | 736 if swallow_exception: |
| 737 return 1 | 737 return 1 |
| 738 print e | 738 print e |
| 739 return 1 | 739 return 1 |
| 740 return 0 | 740 return 0 |
| 741 | 741 |
| 742 | 742 |
| 743 if __name__ == "__main__": | 743 if __name__ == "__main__": |
| 744 sys.exit(TryChange(None, [], False)) | 744 sys.exit(TryChange(None, [], False)) |
| OLD | NEW |