Commit e52bd5a6 authored by deymo@chromium.org's avatar deymo@chromium.org

my_activity: Add support for short URLs on gerrit.

Added support for the internal and external gerrit short URLs.

BUG=None
TEST=Ran my_activity.py manualy. URLs work.

Review URL: https://chromiumcodereview.appspot.com/23477012

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@220340 0039d316-1c4b-4281-b951-d872f2087c98
parent 943f35a5
...@@ -118,10 +118,12 @@ gerrit_instances = [ ...@@ -118,10 +118,12 @@ gerrit_instances = [
{ {
'url': 'gerrit.chromium.org', 'url': 'gerrit.chromium.org',
'port': 29418, 'port': 29418,
'shorturl': 'crosreview.com',
}, },
{ {
'url': 'gerrit-int.chromium.org', 'url': 'gerrit-int.chromium.org',
'port': 29419, 'port': 29419,
'shorturl': 'crosreview.com/i',
}, },
] ]
...@@ -394,15 +396,18 @@ class MyActivity(object): ...@@ -394,15 +396,18 @@ class MyActivity(object):
issues = map(json.loads, issues) issues = map(json.loads, issues)
# TODO(cjhopman): should we filter abandoned changes? # TODO(cjhopman): should we filter abandoned changes?
issues = map(self.process_gerrit_issue, issues) issues = [self.process_gerrit_issue(instance, issue) for issue in issues]
issues = filter(self.filter_issue, issues) issues = filter(self.filter_issue, issues)
issues = sorted(issues, key=lambda i: i['modified'], reverse=True) issues = sorted(issues, key=lambda i: i['modified'], reverse=True)
return issues return issues
def process_gerrit_issue(self, issue): def process_gerrit_issue(self, instance, issue):
ret = {} ret = {}
ret['review_url'] = issue['url'] ret['review_url'] = issue['url']
if 'shorturl' in instance:
ret['review_url'] = 'http://%s/%s' % (instance['shorturl'],
issue['number'])
ret['header'] = issue['subject'] ret['header'] = issue['subject']
ret['owner'] = issue['owner']['email'] ret['owner'] = issue['owner']['email']
ret['author'] = ret['owner'] ret['author'] = ret['owner']
......
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