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
diff --git a/my_activity.py b/my_activity.py
index 35ec4d8..593c187 100755
--- a/my_activity.py
+++ b/my_activity.py
@@ -723,8 +723,8 @@
'-w', '--week_of', metavar='<date>',
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 @@
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: