diff options
| author | Mike Frysinger <vapier@google.com> | 2022-08-19 07:26:38 -0400 |
|---|---|---|
| committer | Mike Frysinger <vapier@google.com> | 2022-08-22 20:48:27 +0000 |
| commit | e6d4b840607835008c54714a4f99f1320dd36e99 (patch) | |
| tree | af8783082a6c1e97b7fe8eeaafaee1cdf3b96816 | |
| parent | d75ca2eb9d83014caa4278c9aaabe94a0b5a67f7 (diff) | |
| download | git-repo-e6d4b840607835008c54714a4f99f1320dd36e99.tar.gz | |
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 <lamontjones@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
| -rw-r--r-- | subcmds/upload.py | 19 |
1 files 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/ | |||
| 262 | answer = sys.stdin.readline().strip().lower() | 262 | answer = sys.stdin.readline().strip().lower() |
| 263 | answer = answer in ('y', 'yes', '1', 'true', 't') | 263 | answer = answer in ('y', 'yes', '1', 'true', 't') |
| 264 | 264 | ||
| 265 | if answer: | 265 | if not opt.yes and answer: |
| 266 | if len(branch.commits) > UNUSUAL_COMMIT_THRESHOLD: | 266 | if len(branch.commits) > UNUSUAL_COMMIT_THRESHOLD: |
| 267 | answer = _ConfirmManyUploads() | 267 | answer = _ConfirmManyUploads() |
| 268 | 268 | ||
| @@ -335,14 +335,15 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
| 335 | if not todo: | 335 | if not todo: |
| 336 | _die("nothing uncommented for upload") | 336 | _die("nothing uncommented for upload") |
| 337 | 337 | ||
| 338 | many_commits = False | 338 | if not opt.yes: |
| 339 | for branch in todo: | 339 | many_commits = False |
| 340 | if len(branch.commits) > UNUSUAL_COMMIT_THRESHOLD: | 340 | for branch in todo: |
| 341 | many_commits = True | 341 | if len(branch.commits) > UNUSUAL_COMMIT_THRESHOLD: |
| 342 | break | 342 | many_commits = True |
| 343 | if many_commits: | 343 | break |
| 344 | if not _ConfirmManyUploads(multiple_branches=True): | 344 | if many_commits: |
| 345 | _die("upload aborted by user") | 345 | if not _ConfirmManyUploads(multiple_branches=True): |
| 346 | _die("upload aborted by user") | ||
| 346 | 347 | ||
| 347 | self._UploadAndReport(opt, todo, people) | 348 | self._UploadAndReport(opt, todo, people) |
| 348 | 349 | ||
