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

Side by Side Diff: trychange.py

Issue 9348068: --print_bots arg to 'gcl try' for debugging PRESUBMIT.py changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
« 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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 group.add_option("--dry_run", action='store_true', 532 group.add_option("--dry_run", action='store_true',
533 help="Don't send the try job. This implies --verbose, so " 533 help="Don't send the try job. This implies --verbose, so "
534 "it will print the diff.") 534 "it will print the diff.")
535 parser.add_option_group(group) 535 parser.add_option_group(group)
536 536
537 group = optparse.OptionGroup(parser, "Try job options") 537 group = optparse.OptionGroup(parser, "Try job options")
538 group.add_option("-b", "--bot", action="append", 538 group.add_option("-b", "--bot", action="append",
539 help="Only use specifics build slaves, ex: " 539 help="Only use specifics build slaves, ex: "
540 "'--bot win,layout_mac'; see the try " 540 "'--bot win,layout_mac'; see the try "
541 "server waterfall for the slave's name") 541 "server waterfall for the slave's name")
542 group.add_option("-B", "--print_bots", action="store_true",
543 help="Print bots we would use (e.g. from PRESUBMIT.py)"
544 " and exit. Do not send patch.")
M-A Ruel 2012/02/08 21:22:55 It's a bit confusing with the fact that --dry_run
542 group.add_option("-r", "--revision", 545 group.add_option("-r", "--revision",
543 help="Revision to use for the try job; default: the " 546 help="Revision to use for the try job; default: the "
544 "revision will be determined by the try server; see " 547 "revision will be determined by the try server; see "
545 "its waterfall for more info") 548 "its waterfall for more info")
546 group.add_option("-c", "--clobber", action="store_true", 549 group.add_option("-c", "--clobber", action="store_true",
547 help="Force a clobber before building; e.g. don't do an " 550 help="Force a clobber before building; e.g. don't do an "
548 "incremental build") 551 "incremental build")
549 # TODO(maruel): help="Select a specific configuration, usually 'debug' or " 552 # TODO(maruel): help="Select a specific configuration, usually 'debug' or "
550 # "'release'" 553 # "'release'"
551 group.add_option("--target", help=optparse.SUPPRESS_HELP) 554 group.add_option("--target", help=optparse.SUPPRESS_HELP)
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 if not options.email: 759 if not options.email:
757 parser.error('Using an anonymous checkout. Please use --email or set ' 760 parser.error('Using an anonymous checkout. Please use --email or set '
758 'the TRYBOT_RESULTS_EMAIL_ADDRESS environment variable.') 761 'the TRYBOT_RESULTS_EMAIL_ADDRESS environment variable.')
759 print('Results will be emailed to: ' + options.email) 762 print('Results will be emailed to: ' + options.email)
760 763
761 if not options.bot: 764 if not options.bot:
762 # Get try slaves from PRESUBMIT.py files if not specified. 765 # Get try slaves from PRESUBMIT.py files if not specified.
763 # Even if the diff comes from options.url, use the local checkout for bot 766 # Even if the diff comes from options.url, use the local checkout for bot
764 # selection. 767 # selection.
765 try: 768 try:
766 import presubmit_support 769 import presubmit_support
M-A Ruel 2012/02/08 21:22:55 This code needs to be extracted in a function so t
767 root_presubmit = checkouts[0].ReadRootFile('PRESUBMIT.py') 770 root_presubmit = checkouts[0].ReadRootFile('PRESUBMIT.py')
768 if not change: 771 if not change:
769 if not changed_files: 772 if not changed_files:
770 changed_files = checkouts[0].file_tuples 773 changed_files = checkouts[0].file_tuples
771 change = presubmit_support.Change(options.name, 774 change = presubmit_support.Change(options.name,
772 '', 775 '',
773 checkouts[0].checkout_root, 776 checkouts[0].checkout_root,
774 changed_files, 777 changed_files,
775 options.issue, 778 options.issue,
776 options.patchset, 779 options.patchset,
777 options.email) 780 options.email)
778 options.bot = presubmit_support.DoGetTrySlaves( 781 options.bot = presubmit_support.DoGetTrySlaves(
779 change, 782 change,
780 checkouts[0].GetFileNames(), 783 checkouts[0].GetFileNames(),
781 checkouts[0].checkout_root, 784 checkouts[0].checkout_root,
782 root_presubmit, 785 root_presubmit,
783 options.project, 786 options.project,
784 False, 787 False,
785 sys.stdout) 788 sys.stdout)
786 except ImportError: 789 except ImportError:
787 pass 790 pass
788 # If no bot is specified, either the default pool will be selected or the 791 # If no bot is specified, either the default pool will be selected or the
789 # try server will refuse the job. Either case we don't need to interfere. 792 # try server will refuse the job. Either case we don't need to interfere.
790 793
794 if options.print_bots:
795 print 'Bots which would be used: ' + str(options.bot)
M-A Ruel 2012/02/08 21:22:55 I'd prefer: print 'Bots which would be used:' for
796 return 0
797
791 # Send the patch. 798 # Send the patch.
792 if options.send_patch: 799 if options.send_patch:
793 # If forced. 800 # If forced.
794 options.send_patch(options) 801 options.send_patch(options)
795 PrintSuccess(options) 802 PrintSuccess(options)
796 return 0 803 return 0
797 try: 804 try:
798 if can_http: 805 if can_http:
799 _SendChangeHTTP(options) 806 _SendChangeHTTP(options)
800 PrintSuccess(options) 807 PrintSuccess(options)
(...skipping 11 matching lines...) Expand all
812 return 1 819 return 1
813 except (gclient_utils.Error, subprocess2.CalledProcessError), e: 820 except (gclient_utils.Error, subprocess2.CalledProcessError), e:
814 print >> sys.stderr, e 821 print >> sys.stderr, e
815 return 1 822 return 1
816 return 0 823 return 0
817 824
818 825
819 if __name__ == "__main__": 826 if __name__ == "__main__":
820 fix_encoding.fix_encoding() 827 fix_encoding.fix_encoding()
821 sys.exit(TryChange(None, None, False)) 828 sys.exit(TryChange(None, 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