Changeset 367:3e0bdfd5dad5
- Timestamp:
- 08/24/08 05:25:18 (3 months ago)
- Author:
- Christos Trochalakis <yatiohi@…>
- Branch:
- default
- Message:
-
hg-shortlog.py changes
- Location:
- devel-docs
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r351
|
r367
|
|
| 12 | 12 | 2. Write NEWS entries since last release:: |
| 13 | 13 | |
| 14 | | hg log --template "{author}\t{desc|firstline}\n" -r tip:0.2 | python \ |
| | 14 | hg log --template "{author|person}\t{desc|firstline}\n" -r tip:0.2 | python \ |
| 15 | 15 | devel-docs/hg-shortlog.py | grep -v trivial > NEWS.new |
| 16 | 16 | gedit NEWS NEWS.new |
-
|
r351
|
r367
|
|
| 1 | | import subprocess |
| | 1 | #!/usr/bin/env python |
| | 2 | # Produces shortlog from hg log output. |
| | 3 | # |
| | 4 | # hg log --template "{author|person}\t{desc|firstline}\n" |
| | 5 | # |
| | 6 | # e.x. Dimitris Glezos<tab>Contributions by Silvio Pierro |
| | 7 | # |
| 2 | 8 | import re |
| 3 | 9 | import sys |
| | 10 | from collections import defaultdict |
| 4 | 11 | |
| 5 | | data = sys.stdin.readlines() |
| | 12 | log_re = re.compile('^(?P<name>.*)\t(?P<msg>.*)$') |
| 6 | 13 | |
| 7 | | p = re.compile('^(.*) <(.*)>\t(.*)$') |
| 8 | | commits = {} |
| | 14 | commit_map = defaultdict(list) |
| 9 | 15 | |
| 10 | | for line in data: |
| 11 | | m = p.match(line) |
| 12 | | try: |
| 13 | | commits[m.group(1)]['count'] += 1 |
| 14 | | commits[m.group(1)]['commits'].append(m.group(3)) |
| 15 | | except KeyError: |
| 16 | | commits[m.group(1)] = {'count': 1, |
| 17 | | 'commits': [m.group(3)]} |
| 18 | | |
| 19 | | for person, data in commits.items(): |
| 20 | | print '\n%s (%s):' % (person, data['count']) |
| 21 | | for commit in data['commits']: |
| 22 | | print ' %s' % commit |
| | 16 | for line in sys.stdin.xreadlines(): |
| | 17 | m = log_re.match(line) |
| | 18 | if m: |
| | 19 | commit_map[m.group('name')].append(m.group('msg')) |
| | 20 | |
| | 21 | for person, commits in commit_map.iteritems(): |
| | 22 | print '%s (%s):' % (person, len(commits)) |
| | 23 | for commit in commits: |
| | 24 | print '\t%s' % commit |