Index: git_cl.py |
diff --git a/git_cl.py b/git_cl.py |
index 58cbd680cd7f7cf990b38a7c31c61390e422e631..9566118c596a8f48457ab215c7bbfa0386110c2f 100755 |
--- a/git_cl.py |
+++ b/git_cl.py |
@@ -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()) |