From e6d4b840607835008c54714a4f99f1320dd36e99 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 19 Aug 2022 07:26:38 -0400 Subject: [PATCH] upload: respect --yes with large upload confirmation If the user passes in --yes, don't prompt them to confirm large uploads. Bug: https://crbug.com/gerrit/14085 Change-Id: Ic801b21be80ba181801531acd4af5057ec10c11c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/343554 Reviewed-by: LaMont Jones Tested-by: Mike Frysinger --- subcmds/upload.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/subcmds/upload.py b/subcmds/upload.py index ac2ed146..d341458d 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py @@ -262,7 +262,7 @@ Gerrit Code Review: https://www.gerritcodereview.com/ answer = sys.stdin.readline().strip().lower() answer = answer in ('y', 'yes', '1', 'true', 't') - if answer: + if not opt.yes and answer: if len(branch.commits) > UNUSUAL_COMMIT_THRESHOLD: answer = _ConfirmManyUploads() @@ -335,14 +335,15 @@ Gerrit Code Review: https://www.gerritcodereview.com/ if not todo: _die("nothing uncommented for upload") - many_commits = False - for branch in todo: - if len(branch.commits) > UNUSUAL_COMMIT_THRESHOLD: - many_commits = True - break - if many_commits: - if not _ConfirmManyUploads(multiple_branches=True): - _die("upload aborted by user") + if not opt.yes: + many_commits = False + for branch in todo: + if len(branch.commits) > UNUSUAL_COMMIT_THRESHOLD: + many_commits = True + break + if many_commits: + if not _ConfirmManyUploads(multiple_branches=True): + _die("upload aborted by user") self._UploadAndReport(opt, todo, people)