Fix "git cl diff" when run on branch without an issue.
BUG=321279
Review URL: https://codereview.chromium.org/86133002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@237110 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_cl.py b/git_cl.py
index 03bd879..3cb6623 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2160,7 +2160,10 @@
def CMDdiff(parser, args):
"""shows differences between local tree and last upload."""
cl = Changelist()
+ issue = cl.GetIssue()
branch = cl.GetBranch()
+ if not issue:
+ DieWithError('No issue found for current branch (%s)' % branch)
TMP_BRANCH = 'git-cl-diff'
base_branch = RunGit(['merge-base', cl.GetUpstreamBranch(), 'HEAD']).strip()
@@ -2168,7 +2171,7 @@
RunGit(['checkout', '-q', '-b', TMP_BRANCH, base_branch])
try:
# Patch in the latest changes from rietveld.
- rtn = PatchIssue(cl.GetIssue(), False, False, None)
+ rtn = PatchIssue(issue, False, False, None)
if rtn != 0:
return rtn