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): ...@@ -595,6 +595,8 @@ class MyActivity(object):
change['header'], change['header'],
change['review_url'], change['review_url'],
change['author'], change['author'],
change['created'],
change['modified'],
optional_values) optional_values)
def print_issue(self, issue): def print_issue(self, issue):
...@@ -609,6 +611,8 @@ class MyActivity(object): ...@@ -609,6 +611,8 @@ class MyActivity(object):
issue['header'], issue['header'],
issue['url'], issue['url'],
issue['author'], issue['author'],
issue['created'],
issue['modified'],
optional_values) optional_values)
def print_review(self, review): def print_review(self, review):
...@@ -631,11 +635,13 @@ class MyActivity(object): ...@@ -631,11 +635,13 @@ class MyActivity(object):
review['header'], review['header'],
review['review_url'], review['review_url'],
review['author'], review['author'],
review['created'],
review['modified'],
optional_values) optional_values)
@staticmethod @staticmethod
def print_generic(default_fmt, specific_fmt, def print_generic(default_fmt, specific_fmt,
title, url, author, title, url, author, created, modified,
optional_values=None): optional_values=None):
output_format = specific_fmt if specific_fmt is not None else default_fmt output_format = specific_fmt if specific_fmt is not None else default_fmt
output_format = unicode(output_format) output_format = unicode(output_format)
...@@ -643,6 +649,8 @@ class MyActivity(object): ...@@ -643,6 +649,8 @@ class MyActivity(object):
'title': title, 'title': title,
'url': url, 'url': url,
'author': author, 'author': author,
'created': created,
'modified': modified,
} }
if optional_values is not None: if optional_values is not None:
values.update(optional_values) values.update(optional_values)
...@@ -930,9 +938,10 @@ def main(): ...@@ -930,9 +938,10 @@ def main():
'individually for each activity type. The format ' 'individually for each activity type. The format '
'is defined as documented for ' 'is defined as documented for '
'string.format(...). The variables available for ' 'string.format(...). The variables available for '
'all activity types are url, title and author. ' 'all activity types are url, title, author, '
'Format options for specific activity types will ' 'created and modified. Format options for '
'override the generic format.') 'specific activity types will override the '
'generic format.')
output_format_group.add_option( output_format_group.add_option(
'-f', '--output-format', metavar='<format>', '-f', '--output-format', metavar='<format>',
default=u'{url} {title}', 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