diff --git a/git_cl.py b/git_cl.py index 97f4372c6..72a9b9254 100755 --- a/git_cl.py +++ b/git_cl.py @@ -4604,6 +4604,11 @@ def CMDsplit(parser, args): "infrastructure. Try to upload these not during high " "load times (usually 11-3 Mountain View time). Email " "infra-dev@chromium.org with any questions.") + parser.add_option('-a', '--enable-auto-submit', action='store_true', + default=True, + help='Sends your change to the CQ after an approval. Only ' + 'works on repos that have the Auto-Submit label ' + 'enabled') options, _ = parser.parse_args(args) if not options.description_file: @@ -4614,7 +4619,7 @@ def CMDsplit(parser, args): return split_cl.SplitCl(options.description_file, options.comment_file, Changelist, WrappedCMDupload, options.dry_run, - options.cq_dry_run) + options.cq_dry_run, options.enable_auto_submit) @subcommand.usage('DEPRECATED') diff --git a/split_cl.py b/split_cl.py index e501329d8..1e93975fb 100644 --- a/split_cl.py +++ b/split_cl.py @@ -75,7 +75,7 @@ def AddUploadedByGitClSplitToDescription(description): def UploadCl(refactor_branch, refactor_branch_upstream, directory, files, description, comment, reviewers, changelist, cmd_upload, - cq_dry_run): + cq_dry_run, enable_auto_submit): """Uploads a CL with all changes to |files| in |refactor_branch|. Args: @@ -90,6 +90,7 @@ def UploadCl(refactor_branch, refactor_branch_upstream, directory, files, changelist: The Changelist class. cmd_upload: The function associated with the git cl upload command. cq_dry_run: If CL uploads should also do a cq dry run. + enable_auto_submit: If CL uploads should also enable auto submit. """ # Create a branch. if not CreateBranchForDirectory( @@ -121,6 +122,8 @@ def UploadCl(refactor_branch, refactor_branch_upstream, directory, files, upload_args.append('--cq-dry-run') if not comment: upload_args.append('--send-mail') + if enable_auto_submit: + upload_args.append('--enable-auto-submit') print 'Uploading CL for ' + directory + '.' cmd_upload(upload_args) if comment: @@ -168,7 +171,7 @@ def PrintClInfo(cl_index, num_cls, directory, file_paths, description, def SplitCl(description_file, comment_file, changelist, cmd_upload, dry_run, - cq_dry_run): + cq_dry_run, enable_auto_submit): """"Splits a branch into smaller branches and uploads CLs. Args: @@ -178,6 +181,7 @@ def SplitCl(description_file, comment_file, changelist, cmd_upload, dry_run, cmd_upload: The function associated with the git cl upload command. dry_run: Whether this is a dry run (no branches or CLs created). cq_dry_run: If CL uploads should also do a cq dry run. + enable_auto_submit: If CL uploads should also enable auto submit. Returns: 0 in case of success. 1 in case of error. @@ -236,7 +240,7 @@ def SplitCl(description_file, comment_file, changelist, cmd_upload, dry_run, else: UploadCl(refactor_branch, refactor_branch_upstream, directory, files, description, comment, reviewers, changelist, cmd_upload, - cq_dry_run) + cq_dry_run, enable_auto_submit) # Go back to the original branch. git.run('checkout', refactor_branch)