Commit 860378ee authored by Lutz Justen's avatar Lutz Justen Committed by Commit Bot

my_activity.py: Add date to format

Allows adding the created and modified dates to the output. Doesn't
change the default behavior.

Example:
$ my_activity.py --begin=01/01/19 -f "{created} {modified} {url} {title}"
2018-12-19 2019-01-09 https://crbug.com/916521 Tests do not resolve libbrillo-libchrome dependency properly
2018-12-05 2019-01-14 https://crbug.com/912312 authpolicy: Cache authentication data

BUG=None

Change-Id: Idfe8aa9553dfb8f9774ee4915e85b6167e6fb75b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1511252
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
parent 18bfe479
......@@ -595,6 +595,8 @@ class MyActivity(object):
change['header'],
change['review_url'],
change['author'],
change['created'],
change['modified'],
optional_values)
def print_issue(self, issue):
......@@ -609,6 +611,8 @@ class MyActivity(object):
issue['header'],
issue['url'],
issue['author'],
issue['created'],
issue['modified'],
optional_values)
def print_review(self, review):
......@@ -631,11 +635,13 @@ class MyActivity(object):
review['header'],
review['review_url'],
review['author'],
review['created'],
review['modified'],
optional_values)
@staticmethod
def print_generic(default_fmt, specific_fmt,
title, url, author,
title, url, author, created, modified,
optional_values=None):
output_format = specific_fmt if specific_fmt is not None else default_fmt
output_format = unicode(output_format)
......@@ -643,6 +649,8 @@ class MyActivity(object):
'title': title,
'url': url,
'author': author,
'created': created,
'modified': modified,
}
if optional_values is not None:
values.update(optional_values)
......@@ -930,9 +938,10 @@ def main():
'individually for each activity type. The format '
'is defined as documented for '
'string.format(...). The variables available for '
'all activity types are url, title and author. '
'Format options for specific activity types will '
'override the generic format.')
'all activity types are url, title, author, '
'created and modified. Format options for '
'specific activity types will override the '
'generic format.')
output_format_group.add_option(
'-f', '--output-format', metavar='<format>',
default=u'{url} {title}',
......
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