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

Side by Side Diff: git_cl.py

Issue 1132913005: Make buildbucket default for git cl try (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 years, 7 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 # Copyright (C) 2008 Evan Martin <martine@danga.com> 6 # Copyright (C) 2008 Evan Martin <martine@danga.com>
7 7
8 """A git-command for integrating reviews on Rietveld.""" 8 """A git-command for integrating reviews on Rietveld."""
9 9
10 from distutils.version import LooseVersion 10 from distutils.version import LooseVersion
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 POSTUPSTREAM_HOOK_PATTERN = '.git/hooks/post-cl-%s' 59 POSTUPSTREAM_HOOK_PATTERN = '.git/hooks/post-cl-%s'
60 DESCRIPTION_BACKUP_FILE = '~/.git_cl_description_backup' 60 DESCRIPTION_BACKUP_FILE = '~/.git_cl_description_backup'
61 GIT_INSTRUCTIONS_URL = 'http://code.google.com/p/chromium/wiki/UsingGit' 61 GIT_INSTRUCTIONS_URL = 'http://code.google.com/p/chromium/wiki/UsingGit'
62 CHANGE_ID = 'Change-Id:' 62 CHANGE_ID = 'Change-Id:'
63 REFS_THAT_ALIAS_TO_OTHER_REFS = { 63 REFS_THAT_ALIAS_TO_OTHER_REFS = {
64 'refs/remotes/origin/lkgr': 'refs/remotes/origin/master', 64 'refs/remotes/origin/lkgr': 'refs/remotes/origin/master',
65 'refs/remotes/origin/lkcr': 'refs/remotes/origin/master', 65 'refs/remotes/origin/lkcr': 'refs/remotes/origin/master',
66 } 66 }
67 67
68 # Buildbucket-related constants 68 # Buildbucket-related constants
69 BUILDBUCKET_HOST = 'cr-buildbucket.appspot.com' 69 BUILDBUCKET_HOST = 'cr-buildbucket.appspot.com'
nodir 2015/07/15 21:22:14 Please make this configurable via an option
sheyang 2015/07/16 17:29:49 Done.
70 70
71 # Valid extensions for files we want to lint. 71 # Valid extensions for files we want to lint.
72 DEFAULT_LINT_REGEX = r"(.*\.cpp|.*\.cc|.*\.h)" 72 DEFAULT_LINT_REGEX = r"(.*\.cpp|.*\.cc|.*\.h)"
73 DEFAULT_LINT_IGNORE_REGEX = r"$^" 73 DEFAULT_LINT_IGNORE_REGEX = r"$^"
74 74
75 # Shortcut since it quickly becomes redundant. 75 # Shortcut since it quickly becomes redundant.
76 Fore = colorama.Fore 76 Fore = colorama.Fore
77 77
78 # Initialized in main() 78 # Initialized in main()
79 settings = None 79 settings = None
(...skipping 2772 matching lines...) Expand 10 before | Expand all | Expand 10 after
2852 2852
2853 print "The tree is %s" % status 2853 print "The tree is %s" % status
2854 print 2854 print
2855 print GetTreeStatusReason() 2855 print GetTreeStatusReason()
2856 if status != 'open': 2856 if status != 'open':
2857 return 1 2857 return 1
2858 return 0 2858 return 0
2859 2859
2860 2860
2861 def CMDtry(parser, args): 2861 def CMDtry(parser, args):
2862 """Triggers a try job through Rietveld.""" 2862 """Triggers a try job through BuildBucket."""
2863 parser.set_defaults(buildbucket=True)
2863 group = optparse.OptionGroup(parser, "Try job options") 2864 group = optparse.OptionGroup(parser, "Try job options")
2864 group.add_option( 2865 group.add_option(
2865 "-b", "--bot", action="append", 2866 "-b", "--bot", action="append",
2866 help=("IMPORTANT: specify ONE builder per --bot flag. Use it multiple " 2867 help=("IMPORTANT: specify ONE builder per --bot flag. Use it multiple "
2867 "times to specify multiple builders. ex: " 2868 "times to specify multiple builders. ex: "
2868 "'-b win_rel -b win_layout'. See " 2869 "'-b win_rel -b win_layout'. See "
2869 "the try server waterfall for the builders name and the tests " 2870 "the try server waterfall for the builders name and the tests "
2870 "available.")) 2871 "available."))
2871 group.add_option( 2872 group.add_option(
2872 "-m", "--master", default='', 2873 "-m", "--master", default='',
2873 help=("Specify a try master where to run the tries.")) 2874 help=("Specify a try master where to run the tries."))
2874 group.add_option( 2875 group.add_option(
2875 "-r", "--revision", 2876 "-r", "--revision",
2876 help="Revision to use for the try job; default: the " 2877 help="Revision to use for the try job; default: the "
2877 "revision will be determined by the try server; see " 2878 "revision will be determined by the try server; see "
2878 "its waterfall for more info") 2879 "its waterfall for more info")
2879 group.add_option( 2880 group.add_option(
2880 "-c", "--clobber", action="store_true", default=False, 2881 "-c", "--clobber", action="store_true", default=False,
2881 help="Force a clobber before building; e.g. don't do an " 2882 help="Force a clobber before building; e.g. don't do an "
2882 "incremental build") 2883 "incremental build")
2883 group.add_option( 2884 group.add_option(
2884 "--project", 2885 "--project",
2885 help="Override which project to use. Projects are defined " 2886 help="Override which project to use. Projects are defined "
2886 "server-side to define what default bot set to use") 2887 "server-side to define what default bot set to use")
2887 group.add_option( 2888 group.add_option(
2888 "-n", "--name", help="Try job name; default to current branch name") 2889 "-n", "--name", help="Try job name; default to current branch name")
2889 group.add_option( 2890 group.add_option(
2890 "--use-buildbucket", action="store_true", default=False, 2891 "--use-buildbucket", dest='buildbucket', action="store_true",
2891 help="Use buildbucket to trigger try jobs.") 2892 help="Use buildbucket to trigger try jobs.")
2893 group.add_option(
2894 "--nouse-buildbucket", dest='buildbucket', action="store_false",
nodir 2015/07/15 21:22:14 Why do you need both options?
sheyang 2015/07/16 17:29:49 Don't remember, probably just want to preserve "--
2895 help="Use Rietveld to trigger try jobs.")
2892 parser.add_option_group(group) 2896 parser.add_option_group(group)
2893 auth.add_auth_options(parser) 2897 auth.add_auth_options(parser)
2894 options, args = parser.parse_args(args) 2898 options, args = parser.parse_args(args)
2895 auth_config = auth.extract_auth_config_from_options(options) 2899 auth_config = auth.extract_auth_config_from_options(options)
2896 2900
2897 if args: 2901 if args:
2898 parser.error('Unknown arguments: %s' % args) 2902 parser.error('Unknown arguments: %s' % args)
2899 2903
2900 cl = Changelist(auth_config=auth_config) 2904 cl = Changelist(auth_config=auth_config)
2901 if not cl.GetIssue(): 2905 if not cl.GetIssue():
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2979 'Instead send your job to the parent.\n' 2983 'Instead send your job to the parent.\n'
2980 'Bot list: %s' % builders) 2984 'Bot list: %s' % builders)
2981 return 1 2985 return 1
2982 2986
2983 patchset = cl.GetMostRecentPatchset() 2987 patchset = cl.GetMostRecentPatchset()
2984 if patchset and patchset != cl.GetPatchset(): 2988 if patchset and patchset != cl.GetPatchset():
2985 print( 2989 print(
2986 '\nWARNING Mismatch between local config and server. Did a previous ' 2990 '\nWARNING Mismatch between local config and server. Did a previous '
2987 'upload fail?\ngit-cl try always uses latest patchset from rietveld. ' 2991 'upload fail?\ngit-cl try always uses latest patchset from rietveld. '
2988 'Continuing using\npatchset %s.\n' % patchset) 2992 'Continuing using\npatchset %s.\n' % patchset)
2989 if options.use_buildbucket: 2993 if options.buildbucket:
2990 try: 2994 try:
2991 trigger_try_jobs(auth_config, cl, options, masters, 'git_cl_try') 2995 trigger_try_jobs(auth_config, cl, options, masters, 'git_cl_try')
2992 except BuildbucketResponseException as ex: 2996 except BuildbucketResponseException as ex:
2993 print 'ERROR: %s' % ex 2997 print 'ERROR: %s' % ex
2994 return 1 2998 return 1
2995 except Exception as e: 2999 except Exception as e:
2996 stacktrace = (''.join(traceback.format_stack()) + traceback.format_exc()) 3000 stacktrace = (''.join(traceback.format_stack()) + traceback.format_exc())
2997 print 'ERROR: Exception when trying to trigger tryjobs: %s\n%s' % ( 3001 print 'ERROR: Exception when trying to trigger tryjobs: %s\n%s' % (
2998 e, stacktrace) 3002 e, stacktrace)
2999 return 1 3003 return 1
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
3342 if __name__ == '__main__': 3346 if __name__ == '__main__':
3343 # These affect sys.stdout so do it outside of main() to simplify mocks in 3347 # These affect sys.stdout so do it outside of main() to simplify mocks in
3344 # unit testing. 3348 # unit testing.
3345 fix_encoding.fix_encoding() 3349 fix_encoding.fix_encoding()
3346 colorama.init() 3350 colorama.init()
3347 try: 3351 try:
3348 sys.exit(main(sys.argv[1:])) 3352 sys.exit(main(sys.argv[1:]))
3349 except KeyboardInterrupt: 3353 except KeyboardInterrupt:
3350 sys.stderr.write('interrupted\n') 3354 sys.stderr.write('interrupted\n')
3351 sys.exit(1) 3355 sys.exit(1)
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