-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
make_changelog.py
66 lines (53 loc) · 1.45 KB
/
make_changelog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from git import Repo
# Usage: python3 misc/make_changelog.py 0.5.9
import sys
ver = sys.argv[1]
g = Repo('.')
commits = list(g.iter_commits('master', max_count=200))
begin, end = -1, 0
def format(c):
return f'{c.summary} (by **{c.author}**)'
print('Notable changes:')
notable_changes = {}
all_changes = []
details = {
'cpu': 'CPU backends',
'cuda': 'CUDA backend',
'doc': 'Documentation',
'infra': 'Infrastructure',
'ir': 'Intermediate representation',
'lang': 'Language and syntax',
'metal': 'Metal backend',
'misc': 'Miscellaneous',
'opt': 'Optimization',
}
print(f'- (, 2020) v{ver} released')
for i, c in enumerate(commits):
s = format(c)
if s.startswith('[release]'):
break
tags = []
while s[0] == '[':
r = s.find(']')
tag = s[1:r]
tags.append(tag)
s = s[r + 1:]
for tag in tags:
if tag[0].isupper():
tag = tag.lower()
if tag not in notable_changes:
notable_changes[tag] = []
notable_changes[tag].append(s)
if s.startswith('[release]'):
break
all_changes.append(format(c))
for tag in sorted(notable_changes.keys()):
print(f' - **{details[tag]}**')
for item in notable_changes[tag]:
print(f' -{item}')
print(
f' - [Full log](https://github.com/taichi-dev/taichi/releases/tag/{ver})'
)
print('Full changelog:')
for c in all_changes:
print(f' - {c}')