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

Side by Side Diff: my_reviews.py

Issue 194753007: Validate input dates in my_reviews.py. (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/depot_tools/
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Get rietveld stats about the review you done, or forgot to do. 6 """Get rietveld stats about the review you done, or forgot to do.
7 7
8 Example: 8 Example:
9 - my_reviews.py -r me@chromium.org -Q for stats for last quarter. 9 - my_reviews.py -r me@chromium.org -Q for stats for last quarter.
10 """ 10 """
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 if args: 335 if args:
336 parser.error('Args unsupported') 336 parser.error('Args unsupported')
337 if not options.reviewer: 337 if not options.reviewer:
338 parser.error('$EMAIL_ADDRESS is not set, please use -r') 338 parser.error('$EMAIL_ADDRESS is not set, please use -r')
339 print >> sys.stderr, 'Searching for reviews by %s' % options.reviewer 339 print >> sys.stderr, 'Searching for reviews by %s' % options.reviewer
340 if options.last_quarter: 340 if options.last_quarter:
341 options.begin = begin 341 options.begin = begin
342 options.end = end 342 options.end = end
343 print >> sys.stderr, 'Using range %s to %s' % ( 343 print >> sys.stderr, 'Using range %s to %s' % (
344 options.begin, options.end) 344 options.begin, options.end)
345
346 # Validate dates.
347 try:
348 to_datetime(options.begin)
349 to_datetime(options.end)
350 except ValueError as e:
351 parser.error('%s: %s - %s' % (e, options.begin, options.end))
352
345 if options.count: 353 if options.count:
346 print_count( 354 print_count(
347 options.reviewer, 355 options.reviewer,
348 options.begin, 356 options.begin,
349 options.end, 357 options.end,
350 options.instance_url) 358 options.instance_url)
351 else: 359 else:
352 print_reviews( 360 print_reviews(
353 options.reviewer, 361 options.reviewer,
354 options.begin, 362 options.begin,
355 options.end, 363 options.end,
356 options.instance_url) 364 options.instance_url)
357 return 0 365 return 0
358 366
359 367
360 if __name__ == '__main__': 368 if __name__ == '__main__':
361 sys.exit(main()) 369 sys.exit(main())
OLDNEW
« 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