Skip to content

Commit

Permalink
Ensure that changelog entries are ordered
Browse files Browse the repository at this point in the history
I just had some shuffled around due to rebasing, so I thought our check
should look at order as well as existence.
See https://xkcd.com/208/
  • Loading branch information
Zac-HD committed May 10, 2017
1 parent 69b7f59 commit ea027ea
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions scripts/check-changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from __future__ import division, print_function, absolute_import

import os
import re
import sys
from datetime import datetime, timedelta

Expand All @@ -41,11 +42,21 @@
for d in (now, now + hour, now - hour)
))

for line in tools.changelog().split('\n'):
if line.strip() in acceptable_lines:
pattern = r'\n\d+\.\d+\.\d+ - \d\d\d\d-\d\d-\d\d\n'
all_versions = list(map(str.strip, re.findall(pattern, tools.changelog())))

for line in acceptable_lines:
if line == all_versions[0]:
break
elif line in all_versions:
print('Changelog entry %r is not the first entry! Check for '
'merge errors.' % line)
sys.exit(1)
else:
print('No line with version and current date (%s) in the changelog. '
'Remember this will be released as soon as you merge to master!'
% ' or '.join(repr(line) for line in acceptable_lines))
sys.exit(1)

assert all_versions == sorted(all_versions), \
'You edited old release notes and changed the ordering!'

0 comments on commit ea027ea

Please sign in to comment.