Skip to content

Commit

Permalink
[misc] misc/make_changelog.py for automatically generating changelo…
Browse files Browse the repository at this point in the history
…gs (#679)

* misc/make_changelog.py

* [skip ci] make_changelog

* [skip ci] format
  • Loading branch information
yuanming-hu committed Mar 29, 2020
1 parent 3286fec commit 1401853
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions misc/make_changelog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,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}')

0 comments on commit 1401853

Please sign in to comment.