summaryrefslogtreecommitdiffstats
path: root/subcmds/upload.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2016-04-04 17:31:32 -0400
committerMike Frysinger <vapier@google.com>2016-09-14 00:16:37 -0400
commit163a3be18b92b9deb0a99795fab7b6ca819f1ecc (patch)
tree947ff65483b92eddda1563fc1e46810ee31bf05a /subcmds/upload.py
parent7a77c16d376f504bd06d017ba10c91e3a6073b08 (diff)
downloadgit-repo-163a3be18b92b9deb0a99795fab7b6ca819f1ecc.tar.gz
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
Diffstat (limited to 'subcmds/upload.py')
-rw-r--r--subcmds/upload.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py
index 4b05f1e8..1172dadc 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -454,7 +454,11 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
454 if avail: 454 if avail:
455 pending.append((project, avail)) 455 pending.append((project, avail))
456 456
457 if pending and (not opt.bypass_hooks): 457 if not pending:
458 print("no branches ready for upload", file=sys.stderr)
459 return
460
461 if not opt.bypass_hooks:
458 hook = RepoHook('pre-upload', self.manifest.repo_hooks_project, 462 hook = RepoHook('pre-upload', self.manifest.repo_hooks_project,
459 self.manifest.topdir, 463 self.manifest.topdir,
460 self.manifest.manifestProject.GetRemote('origin').url, 464 self.manifest.manifestProject.GetRemote('origin').url,
@@ -474,9 +478,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
474 cc = _SplitEmails(opt.cc) 478 cc = _SplitEmails(opt.cc)
475 people = (reviewers, cc) 479 people = (reviewers, cc)
476 480
477 if not pending: 481 if len(pending) == 1 and len(pending[0][1]) == 1:
478 print("no branches ready for upload", file=sys.stderr)
479 elif len(pending) == 1 and len(pending[0][1]) == 1:
480 self._SingleBranch(opt, pending[0][1][0], people) 482 self._SingleBranch(opt, pending[0][1][0], people)
481 else: 483 else:
482 self._MultipleBranches(opt, pending, people) 484 self._MultipleBranches(opt, pending, people)