Add error message to presubmit failure
Add error message to pre-upload script in the case where the remote branch does
not fit the standard '<remote>/<branch name>' format.
Previously the presubmit checks would error without printing the
relevant branch name.
BUG=None
TEST=repo upload .
Change-Id: I82545f3661b4f0403da71da73027b4b7e115d62a
Reviewed-on: https://chromium-review.googlesource.com/1179113
Commit-Ready: Josh Pratt <jopra@chromium.org>
Tested-by: Josh Pratt <jopra@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 374b821..716c83b 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -1752,7 +1752,15 @@
file=sys.stderr)
remote = None
else:
- remote, _branch = remote_branch.split('/', 1)
+ branch_items = remote_branch.split('/', 1)
+ if len(branch_items) != 2:
+ PrintErrorForProject(
+ project_name,
+ HookFailure(
+ 'Cannot get remote and branch name (%s)' % remote_branch))
+ os.chdir(pwd)
+ return True
+ remote, _branch = branch_items
project = Project(name=project_name, dir=proj_dir, remote=remote)