-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[misc]
misc/make_changelog.py
for automatically generating changelo…
…gs (#679) * misc/make_changelog.py * [skip ci] make_changelog * [skip ci] format
- Loading branch information
1 parent
3286fec
commit 1401853
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}') |