From 8ba1ddb3d6d23724d2200f5b76591ccb3b3eaedd Mon Sep 17 00:00:00 2001 From: "wychen@chromium.org" Date: Wed, 29 Apr 2015 00:04:25 +0000 Subject: [PATCH] In my_activity.py, multiple --last_week for more weeks Also, if one --last_week option is given, the date range should be strictly one week before when without the option. BUG= Review URL: https://codereview.chromium.org/1086083007 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295052 0039d316-1c4b-4281-b951-d872f2087c98 --- my_activity.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/my_activity.py b/my_activity.py index 35ec4d87f..593c187f4 100755 --- a/my_activity.py +++ b/my_activity.py @@ -723,8 +723,8 @@ def main(): '-w', '--week_of', metavar='', help='Show issues for week of the date') parser.add_option( - '-W', '--last_week', action='store_true', - help='Show last week\'s issues') + '-W', '--last_week', action='count', + help='Show last week\'s issues. Use more times for more weeks.') parser.add_option( '-a', '--auth', action='store_true', @@ -808,7 +808,8 @@ def main(): elif options.week_of: begin, end = (get_week_of(datetime.strptime(options.week_of, '%m/%d/%y'))) elif options.last_week: - begin, end = (get_week_of(datetime.today() - timedelta(days=7))) + begin, end = (get_week_of(datetime.today() - + timedelta(days=1 + 7 * options.last_week))) else: begin, end = (get_week_of(datetime.today() - timedelta(days=1))) else: