Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1302)

Unified Diff: my_reviews.py

Issue 7991002: I can't count. Fix -Q values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: my_reviews.py
diff --git a/my_reviews.py b/my_reviews.py
index d56a0a7ad9ec91eeb0cbe4cf9dce79f473a23499..4509a489734fcef7a8d39e9e61cdeaa41986669e 100755
--- a/my_reviews.py
+++ b/my_reviews.py
@@ -62,31 +62,50 @@ def get_previous_quarter(today):
that is requested.
"""
year = today.year
- month = today.month - (today.month % 3)
- if not month:
- month = 12
+ month = today.month - (today.month % 3) + 1
Peter Mayo 2011/09/22 18:56:07 I would call these begin&end rather than blank and
+ if month <= 0:
+ month += 12
year -= 1
- previous_month = month - 2
+ if month > 12:
+ month -= 12
+ year += 1
+ previous_month = month - 3
+ previous_year = year
+ if previous_month <= 0:
+ previous_month += 12
+ previous_year -= 1
return (
- '%d-%02d-01' % (year, previous_month),
+ '%d-%02d-01' % (previous_year, previous_month),
'%d-%02d-01' % (year, month))
def main():
# Silence upload.py.
rietveld.upload.verbosity = 0
+ today = datetime.date.today()
+ created_after, created_before = get_previous_quarter(today)
parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)
parser.add_option(
'--count', action='store_true',
help='Just count instead of printing individual issues')
- parser.add_option('-o', '--owner')
- parser.add_option('-r', '--reviewer')
- parser.add_option('-c', '--created_after')
- parser.add_option('-C', '--created_before')
+ parser.add_option(
+ '-o', '--owner', metavar='<email>', help='Filter on issue owner')
+ parser.add_option(
+ '-r', '--reviewer', metavar='<email>', help='Filter on issue reviewer')
+ parser.add_option(
+ '-c', '--created_after', metavar='<date>',
+ help='Filter issues created after the date')
+ parser.add_option(
+ '-C', '--created_before', metavar='<date>',
+ help='Filter issues create before the date')
parser.add_option(
'-Q', '--last_quarter', action='store_true',
- help='Use last quarter\'s dates as filter')
- parser.add_option('-i', '--instance_url', default='codereview.chromium.org')
+ help='Use last quarter\'s dates, e.g. %s to %s' % (
+ created_after, created_before))
+ parser.add_option(
+ '-i', '--instance_url', metavar='<host>',
+ default='http://codereview.chromium.org',
+ help='Host to use, default is %default')
# Remove description formatting
parser.format_description = lambda x: parser.description
options, args = parser.parse_args()
@@ -98,8 +117,8 @@ def main():
parser.error('Please specify at least -o or -r')
print >> sys.stderr, 'Defaulting to owner=%s' % options.owner
if options.last_quarter:
- today = datetime.date.today()
- options.created_after, options.created_before = get_previous_quarter(today)
+ options.created_after = created_after
+ options.created_before = created_before
print >> sys.stderr, 'Using range %s to %s' % (
options.created_after, options.created_before)
if options.count:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698