upload: improve no pending CL error handling

Show clearer messages and exit non-zero if there's nothing to upload.

Change-Id: Icd9c13b9b1126610a409fc13d1d11bfc66f5e802
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255834
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger 2020-02-19 00:14:32 -05:00
parent 0258584c72
commit 7a753b8b18

View File

@ -486,8 +486,12 @@ Gerrit Code Review: https://www.gerritcodereview.com/
pending.append((project, avail))
if not pending:
print("no branches ready for upload", file=sys.stderr)
return
if branch is None:
print('repo: error: no branches ready for upload', file=sys.stderr)
else:
print('repo: error: no branches named "%s" ready for upload' %
(branch,), file=sys.stderr)
return 1
if not opt.bypass_hooks:
hook = RepoHook('pre-upload', self.manifest.repo_hooks_project,