Commit ef7c68c5 authored by tandrii@chromium.org's avatar tandrii@chromium.org

git cl diff: fix regression.

Reported in https://codereview.chromium.org/1852803002/#msg5.
Also some cleanup in nearby code AND fix of the git cl diff's previous behavior that actually updated local branch config with latest *uploaded* CL values. 

BUG=579182
R=machenbach@chromium.org,andybons@chromium.org
CC=servolk@chromium.org

Review URL: https://codereview.chromium.org/1871463003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299759 0039d316-1c4b-4281-b951-d872f2087c98
parent 4d7b7975
......@@ -1297,8 +1297,8 @@ class Changelist(object):
def CMDPatchIssue(self, issue_arg, reject, nocommit, directory):
"""Fetches and applies the issue patch from codereview to local branch."""
if issue_arg.isdigit():
parsed_issue_arg = _RietveldParsedIssueNumberArgument(int(issue_arg))
if isinstance(issue_arg, (int, long)) or issue_arg.isdigit():
parsed_issue_arg = _ParsedIssueNumberArgument(int(issue_arg))
else:
# Assume url.
parsed_issue_arg = self._codereview_impl.ParseIssueURL(
......@@ -1603,7 +1603,8 @@ class _RietveldChangelistImpl(_ChangelistCodereviewBase):
if parsed_issue_arg.hostname:
self._rietveld_server = 'https://%s' % parsed_issue_arg.hostname
if parsed_issue_arg.patch_url:
if (isinstance(parsed_issue_arg, _RietveldParsedIssueNumberArgument) and
parsed_issue_arg.patch_url):
assert parsed_issue_arg.patchset
patchset = parsed_issue_arg.patchset
patch_data = urllib2.urlopen(parsed_issue_arg.patch_url).read()
......@@ -4316,6 +4317,9 @@ def CMDdiff(parser, args):
# Create a new branch based on the merge-base
RunGit(['checkout', '-q', '-b', TMP_BRANCH, base_branch])
# Update the cached branch in cl instance, to avoid overwriting original
# branch properties.
cl.branch = cl.branchref = None
try:
rtn = cl.CMDPatchIssue(issue, reject=False, nocommit=False, directory=None)
if rtn != 0:
......
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