Mercurial > kallithea
annotate scripts/shortlog.py @ 8262:66670aff96c5
celery: set default config values in code and remove them from the generated .ini
It is hard to imagine any reason the user should change celery.imports . And if
it ever should change, we want it controlled in code - not left stale in user
controlled config files.
Everybody sould just use .json and there is no reason anybody should specify
that in the .ini ... and it will be the default in Celery 4.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 18 Feb 2020 17:03:09 +0100 |
parents | aa6f17a53b49 |
children | 96b43734025f |
rev | line source |
---|---|
8173
aa6f17a53b49
py3: switch to use Python 3 interpreter, temporarily leaving many things very broken until they have been migrated/fixed in a reviewable way
Mads Kiilerich <mads@kiilerich.com>
parents:
8161
diff
changeset
|
1 #!/usr/bin/env python3 |
7586
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
3 |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
4 """ |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
5 Kallithea script for generating a quick overview of contributors and their |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
6 commit counts in a given revision set. |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
7 """ |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
8 import argparse |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
9 import os |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
10 from collections import Counter |
7811
0a277465fddf
scripts: initial run of import cleanup using isort
Mads Kiilerich <mads@kiilerich.com>
parents:
7586
diff
changeset
|
11 |
8161
2786730e56e0
scripts: use explicit relative imports of contributor_data
Mads Kiilerich <mads@kiilerich.com>
parents:
7811
diff
changeset
|
12 from . import contributor_data |
7586
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
13 |
7811
0a277465fddf
scripts: initial run of import cleanup using isort
Mads Kiilerich <mads@kiilerich.com>
parents:
7586
diff
changeset
|
14 |
7586
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
15 def main(): |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
16 |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
17 parser = argparse.ArgumentParser(description='Generate a list of committers and commit counts.') |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
18 parser.add_argument('revset', |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
19 help='revision set specifying the commits to count') |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
20 args = parser.parse_args() |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
21 |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
22 repo_entries = [ |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
23 (contributor_data.name_fixes.get(name) or contributor_data.name_fixes.get(name.rsplit('<', 1)[0].strip()) or name).rsplit('<', 1)[0].strip() |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
24 for name in (line.strip() |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
25 for line in os.popen("""hg log -r '%s' -T '{author}\n'""" % args.revset).readlines()) |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
26 ] |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
27 |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
28 counter = Counter(repo_entries) |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
29 for name, count in counter.most_common(): |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
30 if name == '': |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
31 continue |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
32 print('%4s %s' % (count, name)) |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
33 |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
34 |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
35 if __name__ == '__main__': |
30e3d0a14f09
scripts/shortlog: new script
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
36 main() |