From 011d4f426c21a745387e62e6d67ddd73cd6ef44e Mon Sep 17 00:00:00 2001 From: Warren Turkal Date: Wed, 27 Nov 2013 16:20:57 -0800 Subject: [PATCH] Don't backtrace when current branch is not uploadable. The backtrace currently occurs when one uses the "--cbr" argument with the repo upload subcommand if the current branch is not tracking an upstream branch. There may be other cases that would backtrace as well, but this is the only one I found so far. Change-Id: Ie712fbb0ce3e7fe3b72769fca89cc4c0e3d2fce0 --- subcmds/upload.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/subcmds/upload.py b/subcmds/upload.py index 7f7585ae..c8091078 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py @@ -422,7 +422,16 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ for project in project_list: if opt.current_branch: cbr = project.CurrentBranch - avail = [project.GetUploadableBranch(cbr)] if cbr else None + up_branch = project.GetUploadableBranch(cbr) + if up_branch: + avail = [up_branch] + else: + avail = None + print('ERROR: Current branch (%s) not uploadable. ' + 'You may be able to type ' + '"git branch --set-upstream-to m/master" to fix ' + 'your branch.' % str(cbr), + file=sys.stderr) else: avail = project.GetUploadableBranches(branch) if avail: