Mercurial > kallithea
comparison scripts/shortlog.py @ 7586:30e3d0a14f09
scripts/shortlog: new script
Useful for release announcements, shortlog.py presents a list of committers
corresponding to the specified revision set, along with their count of
commits in that set.
Example usage:
scripts/shortlog.py "only('.', branch('stable') & tagged() & public() & not '.')"
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Fri, 15 Mar 2019 21:25:49 +0100 |
parents | |
children | 0a277465fddf |
comparison
equal
deleted
inserted
replaced
7585:dc1c9c131466 | 7586:30e3d0a14f09 |
---|---|
1 #!/usr/bin/env python2 | |
2 # -*- coding: utf-8 -*- | |
3 | |
4 """ | |
5 Kallithea script for generating a quick overview of contributors and their | |
6 commit counts in a given revision set. | |
7 """ | |
8 import argparse | |
9 import os | |
10 from collections import Counter | |
11 import contributor_data | |
12 | |
13 def main(): | |
14 | |
15 parser = argparse.ArgumentParser(description='Generate a list of committers and commit counts.') | |
16 parser.add_argument('revset', | |
17 help='revision set specifying the commits to count') | |
18 args = parser.parse_args() | |
19 | |
20 repo_entries = [ | |
21 (contributor_data.name_fixes.get(name) or contributor_data.name_fixes.get(name.rsplit('<', 1)[0].strip()) or name).rsplit('<', 1)[0].strip() | |
22 for name in (line.strip() | |
23 for line in os.popen("""hg log -r '%s' -T '{author}\n'""" % args.revset).readlines()) | |
24 ] | |
25 | |
26 counter = Counter(repo_entries) | |
27 for name, count in counter.most_common(): | |
28 if name == '': | |
29 continue | |
30 print('%4s %s' % (count, name)) | |
31 | |
32 | |
33 if __name__ == '__main__': | |
34 main() |