my_activity: add --completed-issues option.

--completed-issues lists only monorail issues which are owned by the
user and have status Fixed|Verified.

R=sergiyb@chromium.org

Change-Id: I42737bb6ef81ffa463eedee209a2993f68b57d3a
Reviewed-on: https://chromium-review.googlesource.com/1227445
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
This commit is contained in:
Andrii Shyshkalov
2018-09-24 17:29:41 +00:00
committed by Commit Bot
parent baf0927151
commit 8bdc1b8a04

View File

@@ -527,6 +527,7 @@ class MyActivity(object):
def monorail_issue_search(self, project):
epoch = datetime.utcfromtimestamp(0)
# TODO(tandrii): support non-chromium email, too.
user_str = '%s@chromium.org' % self.user
issues = self.monorail_query_issues(project, {
@@ -536,6 +537,13 @@ class MyActivity(object):
'updatedMin': '%d' % (self.modified_after - epoch).total_seconds(),
})
if self.options.completed_issues:
return [
issue for issue in issues
if (self.match(issue['owner']) and
issue['status'].lower() in ('verified', 'fixed'))
]
return [
issue for issue in issues
if issue['author'] == user_str or issue['owner'] == user_str]
@@ -969,6 +977,13 @@ def main():
dest='merged_only',
default=False,
help='Shows only changes that have been merged.')
parser.add_option(
'-C', '--completed-issues',
action='store_true',
dest='completed_issues',
default=False,
help='Shows only monorail issues that have completed (Fixed|Verified) '
'by the user.')
parser.add_option(
'-o', '--output', metavar='<file>',
help='Where to output the results. By default prints to stdout.')