Commit 78dc9841 authored by sbc@chromium.org's avatar sbc@chromium.org

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
parent abc0ca37
...@@ -2160,7 +2160,10 @@ def CMDset_close(parser, args): ...@@ -2160,7 +2160,10 @@ def CMDset_close(parser, args):
def CMDdiff(parser, args): def CMDdiff(parser, args):
"""shows differences between local tree and last upload.""" """shows differences between local tree and last upload."""
cl = Changelist() cl = Changelist()
issue = cl.GetIssue()
branch = cl.GetBranch() branch = cl.GetBranch()
if not issue:
DieWithError('No issue found for current branch (%s)' % branch)
TMP_BRANCH = 'git-cl-diff' TMP_BRANCH = 'git-cl-diff'
base_branch = RunGit(['merge-base', cl.GetUpstreamBranch(), 'HEAD']).strip() base_branch = RunGit(['merge-base', cl.GetUpstreamBranch(), 'HEAD']).strip()
...@@ -2168,7 +2171,7 @@ def CMDdiff(parser, args): ...@@ -2168,7 +2171,7 @@ def CMDdiff(parser, args):
RunGit(['checkout', '-q', '-b', TMP_BRANCH, base_branch]) RunGit(['checkout', '-q', '-b', TMP_BRANCH, base_branch])
try: try:
# Patch in the latest changes from rietveld. # Patch in the latest changes from rietveld.
rtn = PatchIssue(cl.GetIssue(), False, False, None) rtn = PatchIssue(issue, False, False, None)
if rtn != 0: if rtn != 0:
return rtn return rtn
......
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