Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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, e: | |
|
M-A Ruel
2014/03/11 19:44:37
Oh I had forgot; use the new form:
except ValueErr
Lei Zhang
2014/03/11 20:01:47
Done.
| |
| 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()) |
| OLD | NEW |