Commit 2d3da63e authored by tandrii@chromium.org's avatar tandrii@chromium.org

Fetch Gerrit cl description from gitiles.

R=andybons@chromium.org,scottmg@chromium.org
BUG=603207,605563

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300161 0039d316-1c4b-4281-b951-d872f2087c98
parent a69d56c8
......@@ -483,6 +483,17 @@ def GetChangeDetail(host, change, o_params=None):
return ReadHttpJsonResponse(CreateHttpConn(host, path))
def GetChangeDescriptionFromGitiles(url, revision):
"""Query Gitiles for actual commit message for a given url and ref.
url must be obtained from call to GetChangeDetail for a specific
revision (patchset) under 'fetch' key.
"""
parsed = urlparse.urlparse(url)
path = '%s/+/%s?format=json' % (parsed.path, revision)
return ReadHttpJsonResponse(CreateHttpConn(parsed.netloc, path))['message']
def GetChangeCurrentRevision(host, change):
"""Get information about the latest revision for a given change."""
return QueryChanges(host, {}, change, o_params=('CURRENT_REVISION',))
......
......@@ -2161,8 +2161,10 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
return data['revisions'][data['current_revision']]['_number']
def FetchDescription(self):
data = self._GetChangeDetail(['COMMIT_FOOTERS', 'CURRENT_REVISION'])
return data['revisions'][data['current_revision']]['commit_with_footers']
data = self._GetChangeDetail(['CURRENT_REVISION'])
current_rev = data['current_revision']
url = data['revisions'][current_rev]['fetch']['http']['url']
return gerrit_util.GetChangeDescriptionFromGitiles(url, current_rev)
def UpdateDescriptionRemote(self, description):
# TODO(tandrii)
......
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