mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
upload: short circuit when nothing is pending
When nothing is pending, most of this code is already short-circuited. Hoist the single check up to make this more obvious/slightly faster. Change-Id: Iec3a7e08eacd23a7c5f964900d5776bf5252c804
This commit is contained in:
parent
7a77c16d37
commit
163a3be18b
@ -454,7 +454,11 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
|||||||
if avail:
|
if avail:
|
||||||
pending.append((project, avail))
|
pending.append((project, avail))
|
||||||
|
|
||||||
if pending and (not opt.bypass_hooks):
|
if not pending:
|
||||||
|
print("no branches ready for upload", file=sys.stderr)
|
||||||
|
return
|
||||||
|
|
||||||
|
if not opt.bypass_hooks:
|
||||||
hook = RepoHook('pre-upload', self.manifest.repo_hooks_project,
|
hook = RepoHook('pre-upload', self.manifest.repo_hooks_project,
|
||||||
self.manifest.topdir,
|
self.manifest.topdir,
|
||||||
self.manifest.manifestProject.GetRemote('origin').url,
|
self.manifest.manifestProject.GetRemote('origin').url,
|
||||||
@ -474,9 +478,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
|||||||
cc = _SplitEmails(opt.cc)
|
cc = _SplitEmails(opt.cc)
|
||||||
people = (reviewers, cc)
|
people = (reviewers, cc)
|
||||||
|
|
||||||
if not pending:
|
if len(pending) == 1 and len(pending[0][1]) == 1:
|
||||||
print("no branches ready for upload", file=sys.stderr)
|
|
||||||
elif len(pending) == 1 and len(pending[0][1]) == 1:
|
|
||||||
self._SingleBranch(opt, pending[0][1][0], people)
|
self._SingleBranch(opt, pending[0][1][0], people)
|
||||||
else:
|
else:
|
||||||
self._MultipleBranches(opt, pending, people)
|
self._MultipleBranches(opt, pending, people)
|
||||||
|
Loading…
Reference in New Issue
Block a user