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 | 10 |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
445 default_settings.get('default_transport')) | 445 default_settings.get('default_transport')) |
446 | 446 |
447 # Parse argv | 447 # Parse argv |
448 parser = optparse.OptionParser(usage=USAGE, | 448 parser = optparse.OptionParser(usage=USAGE, |
449 version=__version__, | 449 version=__version__, |
450 prog=prog) | 450 prog=prog) |
451 | 451 |
452 group = optparse.OptionGroup(parser, "Result and status") | 452 group = optparse.OptionGroup(parser, "Result and status") |
453 group.add_option("-u", "--user", default=getpass.getuser(), | 453 group.add_option("-u", "--user", default=getpass.getuser(), |
454 help="Owner user name [default: %default]") | 454 help="Owner user name [default: %default]") |
455 group.add_option("-e", "--email", default=os.environ.get('EMAIL_ADDRESS'), | 455 group.add_option("-e", "--email", |
456 help="Email address where to send the results. Use the " | 456 default=os.environ.get('TRYBOT_RESULTS_EMAIL_ADDRESS', |
457 "EMAIL_ADDRESS environment variable to set the default " | 457 os.environ.get('EMAIL_ADDRESS')), |
M-A Ruel
2009/11/09 16:40:09
actually, this line should be +4 but not a big dea
| |
458 "email address [default: %default]") | 458 help="Email address where to send the results. Use either " |
459 "the TRYBOT_RESULTS_EMAIL_ADDRESS environment " | |
460 "variable or EMAIL_ADDRESS to set the email address " | |
461 "the try bots report results to [default: %default]") | |
459 group.add_option("-n", "--name", | 462 group.add_option("-n", "--name", |
460 help="Descriptive name of the try job") | 463 help="Descriptive name of the try job") |
461 group.add_option("--issue", type='int', | 464 group.add_option("--issue", type='int', |
462 help="Update rietveld issue try job status") | 465 help="Update rietveld issue try job status") |
463 group.add_option("--patchset", type='int', | 466 group.add_option("--patchset", type='int', |
464 help="Update rietveld issue try job status") | 467 help="Update rietveld issue try job status") |
465 parser.add_option_group(group) | 468 parser.add_option_group(group) |
466 | 469 |
467 group = optparse.OptionGroup(parser, "Try job options") | 470 group = optparse.OptionGroup(parser, "Try job options") |
468 group.add_option("-b", "--bot", action="append", | 471 group.add_option("-b", "--bot", action="append", |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
583 False, | 586 False, |
584 sys.stdout) | 587 sys.stdout) |
585 | 588 |
586 if options.name is None: | 589 if options.name is None: |
587 if options.issue: | 590 if options.issue: |
588 patch_name = 'Issue %s' % options.issue | 591 patch_name = 'Issue %s' % options.issue |
589 else: | 592 else: |
590 options.name = 'Unnamed' | 593 options.name = 'Unnamed' |
591 print('Note: use --name NAME to change the try job name.') | 594 print('Note: use --name NAME to change the try job name.') |
592 if not options.email: | 595 if not options.email: |
593 print('Warning: try job email will be sent to %s@google.com or ' | 596 print('Warning: TRYBOT_RESULTS_EMAIL_ADDRESS is not set. Try server ' |
594 'something like that. Who knows? Set EMAIL_ADDRESS to override.' | 597 'results might\ngo to: %s@google.com.\n' % options.user) |
595 % options.user) | 598 else: |
599 print('Results will be emailed to: ' + options.email) | |
596 | 600 |
597 # Send the patch. | 601 # Send the patch. |
598 options.send_patch(options) | 602 options.send_patch(options) |
599 print 'Patch \'%s\' sent to try server: %s' % (options.name, | 603 print 'Patch \'%s\' sent to try server: %s' % (options.name, |
600 ', '.join(options.bot)) | 604 ', '.join(options.bot)) |
601 except (InvalidScript, NoTryServerAccess), e: | 605 except (InvalidScript, NoTryServerAccess), e: |
602 if swallow_exception: | 606 if swallow_exception: |
603 return 1 | 607 return 1 |
604 print e | 608 print e |
605 return 1 | 609 return 1 |
606 return 0 | 610 return 0 |
607 | 611 |
608 | 612 |
609 if __name__ == "__main__": | 613 if __name__ == "__main__": |
610 sys.exit(TryChange(None, None, False)) | 614 sys.exit(TryChange(None, None, False)) |
OLD | NEW |