| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 for query in search: | 566 for query in search: |
| 567 query_args = [query] | 567 query_args = [query] |
| 568 query_args.extend(log_args) | 568 query_args.extend(log_args) |
| 569 commits |= set(self.git_cmd(repo, 'log', 'origin/master', *query_args)) | 569 commits |= set(self.git_cmd(repo, 'log', 'origin/master', *query_args)) |
| 570 | 570 |
| 571 ret = [] | 571 ret = [] |
| 572 for commit in commits: | 572 for commit in commits: |
| 573 output = self.git_cmd(repo, 'log', commit + "^!", "--format=%cn%n%cd%n%B") | 573 output = self.git_cmd(repo, 'log', commit + "^!", "--format=%cn%n%cd%n%B") |
| 574 author = output[0] | 574 author = output[0] |
| 575 date = datetime.strptime(output[1], "%a %b %d %H:%M:%S %Y +0000") | 575 date = datetime.strptime(output[1], "%a %b %d %H:%M:%S %Y +0000") |
| 576 ret.append(self.process_git_commit(instance, author, date, output[2:])) | 576 processed = self.process_git_commit(instance, author, date, output[2:]) |
| 577 if processed: |
| 578 ret.append(processed) |
| 577 | 579 |
| 578 ret = sorted(ret, key=lambda i: i['modified'], reverse=True) | 580 ret = sorted(ret, key=lambda i: i['modified'], reverse=True) |
| 579 return ret | 581 return ret |
| 580 | 582 |
| 581 @staticmethod | 583 @staticmethod |
| 582 def process_git_commit(instance, author, date, log): | 584 def process_git_commit(instance, author, date, log): |
| 583 ret = {} | 585 ret = {} |
| 584 ret['owner'] = author | 586 ret['owner'] = author |
| 585 ret['author'] = author | 587 ret['author'] = author |
| 586 ret['modified'] = date | 588 ret['modified'] = date |
| (...skipping 20 matching lines...) Expand all Loading... |
| 607 committer_list = webkitpy.common.config.committers.CommitterList() | 609 committer_list = webkitpy.common.config.committers.CommitterList() |
| 608 ret['reviewers'] = set( | 610 ret['reviewers'] = set( |
| 609 (committer_list.contributor_by_name(r).emails[0] for r in reviewers)) | 611 (committer_list.contributor_by_name(r).emails[0] for r in reviewers)) |
| 610 | 612 |
| 611 # Reviews more useful than change link itself, but tricky if multiple | 613 # Reviews more useful than change link itself, but tricky if multiple |
| 612 # Reviews == bugs for WebKit changes | 614 # Reviews == bugs for WebKit changes |
| 613 if len(reviews) == 1: | 615 if len(reviews) == 1: |
| 614 url = 'http://%s/%d' % (instance['review_url'], reviews[0]) | 616 url = 'http://%s/%d' % (instance['review_url'], reviews[0]) |
| 615 if instance['review_prop']: | 617 if instance['review_prop']: |
| 616 ret[instance['review_prop']] = reviews[0] | 618 ret[instance['review_prop']] = reviews[0] |
| 619 elif len(changes) == 1: |
| 620 url = 'http://%s/%d' % (instance['change_url'], changes[0]) |
| 617 else: | 621 else: |
| 618 url = 'http://%s/%d' % (instance['change_url'], changes[0]) | 622 # Couldn't find anything. |
| 623 return None |
| 619 ret['review_url'] = url | 624 ret['review_url'] = url |
| 620 | 625 |
| 621 return ret | 626 return ret |
| 622 | 627 |
| 623 def bugzilla_issues(self, instance, user): | 628 def bugzilla_issues(self, instance, user): |
| 624 if instance['user_func']: | 629 if instance['user_func']: |
| 625 user = instance['user_func'](user) | 630 user = instance['user_func'](user) |
| 626 if not user: | 631 if not user: |
| 627 return [] | 632 return [] |
| 628 | 633 |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 print '\n\n\n' | 1020 print '\n\n\n' |
| 1016 | 1021 |
| 1017 my_activity.print_changes() | 1022 my_activity.print_changes() |
| 1018 my_activity.print_reviews() | 1023 my_activity.print_reviews() |
| 1019 my_activity.print_issues() | 1024 my_activity.print_issues() |
| 1020 return 0 | 1025 return 0 |
| 1021 | 1026 |
| 1022 | 1027 |
| 1023 if __name__ == '__main__': | 1028 if __name__ == '__main__': |
| 1024 sys.exit(main()) | 1029 sys.exit(main()) |
| OLD | NEW |