Commit 3863fc52 authored by Jose Lopes's avatar Jose Lopes Committed by LUCI CQ

Do not prompt on --dependencies if --force.

At the moment, specifying --dependencies to upload all dependent CLs
will always prompt for confirmation if --force was specified. This
means that there is no way to run this command in a batch way or from
another script, and it's also in contradiction to the --force flag
which is meant to answer 'yes' to all prompts.

This uses a pattern that is used several times in the script, which is
to check 'if not force: prompt()'.

Change-Id: I7d85b02b68d958a5b2d3295a04c4ced023d36ec8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2139700
Auto-Submit: Jose Lopes <jabolopes@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
parent 06c0b50c
......@@ -1424,7 +1424,7 @@ class Changelist(object):
# Remove the dependencies flag from args so that we do not end up in a
# loop.
orig_args.remove('--dependencies')
ret = upload_branch_deps(self, orig_args)
ret = upload_branch_deps(self, orig_args, options.force)
return ret
def SetCQState(self, new_state):
......@@ -3202,7 +3202,7 @@ def get_cl_statuses(changes, fine_grained, max_processes=None):
yield (cl, 'error')
def upload_branch_deps(cl, args):
def upload_branch_deps(cl, args, force=False):
"""Uploads CLs of local branches that are dependents of the current branch.
If the local branch dependency tree looks like:
......@@ -3266,8 +3266,9 @@ def upload_branch_deps(cl, args):
print('There are no dependent local branches for %s' % root_branch)
return 0
confirm_or_exit('This command will checkout all dependent branches and run '
'"git cl upload".', action='continue')
if not force:
confirm_or_exit('This command will checkout all dependent branches and run '
'"git cl upload".', action='continue')
# Record all dependents that failed to upload.
failures = {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment