Commit 53c1e56c authored by cjhopman@chromium.org's avatar cjhopman@chromium.org

Add reviewers to optional outputs for changes

This adds a comma-separated list of reviewers to the optional outputs
for changes. This can be added to the output using the custom formatter
option.  E.g. --output-format-changes="{url} {title} <{reviewers}>"

Also, for webkit changes, use CommitterList to map reviewer names to
emails so that they are similar format to other changes.


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@187351 0039d316-1c4b-4281-b951-d872f2087c98
parent da4bfad4
......@@ -346,14 +346,16 @@ class MyActivity(object):
ret['owner'] = issue['owner_email']
ret['author'] = ret['owner']
ret['reviewers'] = set(username(r) for r in issue['reviewers'])
ret['reviewers'] = set(issue['reviewers'])
shorturl = instance['url']
if 'shorturl' in instance:
shorturl = instance['shorturl']
ret['review_url'] = 'http://%s/%d' % (shorturl, issue['issue'])
ret['header'] = issue['description'].split('\n')[0]
# Rietveld sometimes has '\r\n' instead of '\n'.
ret['header'] = issue['description'].replace('\r', '').split('\n')[0]
ret['modified'] = datetime_from_rietveld(issue['modified'])
ret['created'] = datetime_from_rietveld(issue['created'])
......@@ -410,6 +412,10 @@ class MyActivity(object):
ret['replies'] = self.process_gerrit_issue_replies(issue['comments'])
else:
ret['replies'] = []
ret['reviewers'] = set()
for reply in ret['replies']:
if reply['author'] != ret['author']:
ret['reviewers'].add(reply['author'])
return ret
@staticmethod
......@@ -598,8 +604,9 @@ class MyActivity(object):
if match:
changes.append(int(match.group(1)))
# TODO(enne): should convert full names to usernames via CommitterList.
ret['reviewers'] = set(reviewers)
committer_list = webkitpy.common.config.committers.CommitterList()
ret['reviewers'] = set(
(committer_list.contributor_by_name(r).emails[0] for r in reviewers))
# Reviews more useful than change link itself, but tricky if multiple
# Reviews == bugs for WebKit changes
......@@ -710,11 +717,15 @@ class MyActivity(object):
self.webkit_repo = None
def print_change(self, change):
optional_values = {
'reviewers': ', '.join(change['reviewers'])
}
self.print_generic(self.options.output_format,
self.options.output_format_changes,
change['header'],
change['review_url'],
change['author'])
change['author'],
optional_values)
def print_issue(self, issue):
optional_values = {
......@@ -928,12 +939,13 @@ def main():
output_format_group.add_option(
'--output-format-changes', metavar='<format>',
default=None,
help='Specifies the format to use when printing changes.')
help='Specifies the format to use when printing changes. Supports the '
'additional variable {reviewers}')
output_format_group.add_option(
'--output-format-issues', metavar='<format>',
default=None,
help='Specifies the format to use when printing issues. Has support '
'for the additional variable owner.')
help='Specifies the format to use when printing issues. Supports the '
'additional variable {owner}.')
output_format_group.add_option(
'--output-format-reviews', metavar='<format>',
default=None,
......
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