buildman: Produce a sensible error message when branch is missing
Rather than a backtrace, produce a nice error message when an invalid
branch is provided to buildman.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index 3e5f56c..4319ce7 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -111,6 +111,10 @@
print col.Color(col.RED, str)
sys.exit(1)
count = gitutil.CountCommitsInBranch(options.git_dir, options.branch)
+ if count is None:
+ str = "Branch '%s' not found or has no upstream" % options.branch
+ print col.Color(col.RED, str)
+ sys.exit(1)
count += 1 # Build upstream commit also
if not count: