| 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 stats about your activity. | 6 """Get stats about your activity. |
| 7 | 7 |
| 8 Example: | 8 Example: |
| 9 - my_activity.py for stats for the current week (last week on mondays). | 9 - my_activity.py for stats for the current week (last week on mondays). |
| 10 - my_activity.py -Q for stats for last quarter. | 10 - my_activity.py -Q for stats for last quarter. |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 # Silence upload.py. | 699 # Silence upload.py. |
| 700 rietveld.upload.verbosity = 0 | 700 rietveld.upload.verbosity = 0 |
| 701 | 701 |
| 702 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) | 702 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) |
| 703 parser.add_option( | 703 parser.add_option( |
| 704 '-u', '--user', metavar='<email>', | 704 '-u', '--user', metavar='<email>', |
| 705 default=os.environ.get('USER'), | 705 default=os.environ.get('USER'), |
| 706 help='Filter on user, default=%default') | 706 help='Filter on user, default=%default') |
| 707 parser.add_option( | 707 parser.add_option( |
| 708 '-b', '--begin', metavar='<date>', | 708 '-b', '--begin', metavar='<date>', |
| 709 help='Filter issues created after the date') | 709 help='Filter issues created after the date (mm/dd/yy)') |
| 710 parser.add_option( | 710 parser.add_option( |
| 711 '-e', '--end', metavar='<date>', | 711 '-e', '--end', metavar='<date>', |
| 712 help='Filter issues created before the date') | 712 help='Filter issues created before the date (mm/dd/yy)') |
| 713 quarter_begin, quarter_end = get_quarter_of(datetime.today() - | 713 quarter_begin, quarter_end = get_quarter_of(datetime.today() - |
| 714 relativedelta(months=2)) | 714 relativedelta(months=2)) |
| 715 parser.add_option( | 715 parser.add_option( |
| 716 '-Q', '--last_quarter', action='store_true', | 716 '-Q', '--last_quarter', action='store_true', |
| 717 help='Use last quarter\'s dates, i.e. %s to %s' % ( | 717 help='Use last quarter\'s dates, i.e. %s to %s' % ( |
| 718 quarter_begin.strftime('%Y-%m-%d'), quarter_end.strftime('%Y-%m-%d'))) | 718 quarter_begin.strftime('%Y-%m-%d'), quarter_end.strftime('%Y-%m-%d'))) |
| 719 parser.add_option( | 719 parser.add_option( |
| 720 '-Y', '--this_year', action='store_true', | 720 '-Y', '--this_year', action='store_true', |
| 721 help='Use this year\'s dates') | 721 help='Use this year\'s dates') |
| 722 parser.add_option( | 722 parser.add_option( |
| 723 '-w', '--week_of', metavar='<date>', | 723 '-w', '--week_of', metavar='<date>', |
| 724 help='Show issues for week of the date') | 724 help='Show issues for week of the date (mm/dd/yy)') |
| 725 parser.add_option( | 725 parser.add_option( |
| 726 '-W', '--last_week', action='count', | 726 '-W', '--last_week', action='count', |
| 727 help='Show last week\'s issues. Use more times for more weeks.') | 727 help='Show last week\'s issues. Use more times for more weeks.') |
| 728 parser.add_option( | 728 parser.add_option( |
| 729 '-a', '--auth', | 729 '-a', '--auth', |
| 730 action='store_true', | 730 action='store_true', |
| 731 help='Ask to authenticate for instances with no auth cookie') | 731 help='Ask to authenticate for instances with no auth cookie') |
| 732 | 732 |
| 733 activity_types_group = optparse.OptionGroup(parser, 'Activity Types', | 733 activity_types_group = optparse.OptionGroup(parser, 'Activity Types', |
| 734 'By default, all activity will be looked up and ' | 734 'By default, all activity will be looked up and ' |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 my_activity.print_issues() | 859 my_activity.print_issues() |
| 860 return 0 | 860 return 0 |
| 861 | 861 |
| 862 | 862 |
| 863 if __name__ == '__main__': | 863 if __name__ == '__main__': |
| 864 try: | 864 try: |
| 865 sys.exit(main()) | 865 sys.exit(main()) |
| 866 except KeyboardInterrupt: | 866 except KeyboardInterrupt: |
| 867 sys.stderr.write('interrupted\n') | 867 sys.stderr.write('interrupted\n') |
| 868 sys.exit(1) | 868 sys.exit(1) |
| OLD | NEW |