Skip to content

Commit c20bbcb

Browse files
committed
DOC: Add commit links to release notes
1 parent d2a8d2f commit c20bbcb

File tree

1 file changed

+28
-19
lines changed

1 file changed

+28
-19
lines changed

utilities/release-notes.py

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
fp.write('\n')
3131

3232
fp.write('## Changes from {0} to {1}\n'.format(previous_tag, current_tag))
33-
subjects = subprocess.check_output(['git', 'log', '--pretty=%s',
33+
subjects = subprocess.check_output(['git', 'log', '--pretty=%s:%h',
3434
'--no-merges', '{0}..{1}'.format(previous_tag, current_tag)]).decode('utf-8')
3535

3636
bug_fixes = []
@@ -41,53 +41,62 @@
4141
style_changes = []
4242
for subject in subjects.split('\n'):
4343
prefix = subject.split(':')[0]
44+
commit = subject.split(':')[-1]
4445
if prefix == 'BUG':
4546
description = subject.split(':')[1]
46-
bug_fixes.append(description)
47+
bug_fixes.append((description, commit))
4748
elif prefix == 'COMP':
4849
description = subject.split(':')[1]
49-
platform_fixes.append(description)
50+
platform_fixes.append((description, commit))
5051
elif prefix == 'DOC':
5152
description = subject.split(':')[1]
52-
doc_updates.append(description)
53+
doc_updates.append((description, commit))
5354
elif prefix == 'ENH':
5455
description = subject.split(':')[1]
55-
enhancements.append(description)
56+
enhancements.append((description, commit))
5657
elif prefix == 'PERF':
5758
description = subject.split(':')[1]
58-
performance_improvements.append(description)
59+
performance_improvements.append((description, commit))
5960
elif prefix == 'STYLE':
6061
description = subject.split(':')[1]
61-
style_changes.append(description)
62+
style_changes.append((description, commit))
63+
64+
commit_link_prefix = 'https://github.com/InsightSoftwareConsortium/itkwidgets/commit/'
6265

6366
if enhancements:
6467
fp.write('\n### Enhancements\n\n')
65-
for subject in enhancements:
68+
for subject, commit in enhancements:
6669
if subject.find('Bump itkwidgets version for development') != -1:
6770
continue
68-
fp.write('- {0}\n'.format(subject))
71+
fp.write('- {0}'.format(subject))
72+
fp.write(' ([{0}]({1}{0}))\n'.format(commit, commit_link_prefix))
6973

7074
if performance_improvements:
7175
fp.write('\n### Performance Improvements\n\n')
72-
for subject in performance_improvements:
73-
fp.write('- {0}\n'.format(subject))
76+
for subject, commit in performance_improvements:
77+
fp.write('- {0}'.format(subject))
78+
fp.write(' ([{0}]({1}{0}))\n'.format(commit, commit_link_prefix))
7479

7580
if doc_updates:
7681
fp.write('\n### Documentation Updates\n\n')
77-
for subject in doc_updates:
78-
fp.write('- {0}\n'.format(subject))
82+
for subject, commit in doc_updates:
83+
fp.write('- {0}'.format(subject))
84+
fp.write(' ([{0}]({1}{0}))\n'.format(commit, commit_link_prefix))
7985

8086
if platform_fixes:
8187
fp.write('\n### Platform Fixes\n\n')
82-
for subject in platform_fixes:
83-
fp.write('- {0}\n'.format(subject))
88+
for subject, commit in platform_fixes:
89+
fp.write('- {0}'.format(subject))
90+
fp.write(' ([{0}]({1}{0}))\n'.format(commit, commit_link_prefix))
8491

8592
if bug_fixes:
8693
fp.write('\n### Bug Fixes\n\n')
87-
for subject in bug_fixes:
88-
fp.write('- {0}\n'.format(subject))
94+
for subject, commit in bug_fixes:
95+
fp.write('- {0}'.format(subject))
96+
fp.write(' ([{0}]({1}{0}))\n'.format(commit, commit_link_prefix))
8997

9098
if style_changes:
9199
fp.write('\n### Style Changes\n\n')
92-
for subject in style_changes:
93-
fp.write('- {0}\n'.format(subject))
100+
for subject, commit in style_changes:
101+
fp.write('- {0}'.format(subject))
102+
fp.write(' ([{0}]({1}{0}))\n'.format(commit, commit_link_prefix))

0 commit comments

Comments
 (0)