Support --enable-auto-submit in `git cl split`

With default True.

This CL was uploaded by git cl split.

R=jochen@chromium.org
Bug: 927178
Change-Id: Ie0a68ed7ca381e1bb33341badca153bf409bb376
Reviewed-on: https://chromium-review.googlesource.com/c/1470402
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
changes/02/1470402/5
Takuto Ikuta 6 years ago committed by Commit Bot
parent 3ab00a7d06
commit 51eca59ff6

@ -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')

@ -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)

Loading…
Cancel
Save