Commit 2b38e9cd authored by maruel@chromium.org's avatar maruel@chromium.org

Improve error message when the upstream branch is wrong.

Otherwise, I get a stack trace, which is annoying. Here's an example:

$ git cl upload
Current branch help_text is up to date.

Failed to diff against upstream branch refs/heads/foo!

This branch probably doesn't exist anymore. To reset the
tracking branch, please run
    git branch --set-upstream help_text trunk
replacing trunk with origin/master or the relevant branch


R=dpranke@chromium.org
BUG=
TEST=


Review URL: http://codereview.chromium.org/8349011

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@106175 0039d316-1c4b-4281-b951-d872f2087c98
parent 93a9ee0f
......@@ -495,7 +495,16 @@ or verify this branch is set up to track another (via the --track argument to
# We use the sha1 of HEAD as a name of this change.
name = RunCommand(['git', 'rev-parse', 'HEAD']).strip()
# Need to pass a relative path for msysgit.
files = scm.GIT.CaptureStatus([root], upstream_branch)
try:
files = scm.GIT.CaptureStatus([root], upstream_branch)
except subprocess2.CalledProcessError:
DieWithError(
('\nFailed to diff against upstream branch %s!\n\n'
'This branch probably doesn\'t exist anymore. To reset the\n'
'tracking branch, please run\n'
' git branch --set-upstream %s trunk\n'
'replacing trunk with origin/master or the relevant branch') %
(upstream_branch, self.GetBranch()))
issue = ConvertToInteger(self.GetIssue())
patchset = ConvertToInteger(self.GetPatchset())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment