diff options
Diffstat (limited to 'subcmds')
-rw-r--r-- | subcmds/upload.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py index 6ef4955e..856c7fb9 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -184,6 +184,9 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
184 | p.add_option('-n', '--dry-run', | 184 | p.add_option('-n', '--dry-run', |
185 | dest='dryrun', default=False, action='store_true', | 185 | dest='dryrun', default=False, action='store_true', |
186 | help='Do everything except actually upload the CL.') | 186 | help='Do everything except actually upload the CL.') |
187 | p.add_option('-y', '--yes', | ||
188 | default=False, action='store_true', | ||
189 | help='Answer yes to all safe prompts.') | ||
187 | p.add_option('--no-cert-checks', | 190 | p.add_option('--no-cert-checks', |
188 | dest='validate_certs', action='store_false', default=True, | 191 | dest='validate_certs', action='store_false', default=True, |
189 | help='Disable verifying ssl certs (unsafe).') | 192 | help='Disable verifying ssl certs (unsafe).') |
@@ -244,8 +247,12 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
244 | print('to %s (y/N)? ' % remote.review, end='') | 247 | print('to %s (y/N)? ' % remote.review, end='') |
245 | # TODO: When we require Python 3, use flush=True w/print above. | 248 | # TODO: When we require Python 3, use flush=True w/print above. |
246 | sys.stdout.flush() | 249 | sys.stdout.flush() |
247 | answer = sys.stdin.readline().strip().lower() | 250 | if opt.yes: |
248 | answer = answer in ('y', 'yes', '1', 'true', 't') | 251 | print('<--yes>') |
252 | answer = True | ||
253 | else: | ||
254 | answer = sys.stdin.readline().strip().lower() | ||
255 | answer = answer in ('y', 'yes', '1', 'true', 't') | ||
249 | 256 | ||
250 | if answer: | 257 | if answer: |
251 | if len(branch.commits) > UNUSUAL_COMMIT_THRESHOLD: | 258 | if len(branch.commits) > UNUSUAL_COMMIT_THRESHOLD: |
@@ -384,7 +391,11 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
384 | print('Continue uploading? (y/N) ', end='') | 391 | print('Continue uploading? (y/N) ', end='') |
385 | # TODO: When we require Python 3, use flush=True w/print above. | 392 | # TODO: When we require Python 3, use flush=True w/print above. |
386 | sys.stdout.flush() | 393 | sys.stdout.flush() |
387 | a = sys.stdin.readline().strip().lower() | 394 | if opt.yes: |
395 | print('<--yes>') | ||
396 | a = 'yes' | ||
397 | else: | ||
398 | a = sys.stdin.readline().strip().lower() | ||
388 | if a not in ('y', 'yes', 't', 'true', 'on'): | 399 | if a not in ('y', 'yes', 't', 'true', 'on'): |
389 | print("skipping upload", file=sys.stderr) | 400 | print("skipping upload", file=sys.stderr) |
390 | branch.uploaded = False | 401 | branch.uploaded = False |