Browse Source

Fix sorting of changelog entries

pull/1269/head
Ross McFarland 6 months ago
parent
commit
0fe8519167
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
1 changed files with 4 additions and 7 deletions
  1. +4
    -7
      script/changelog

+ 4
- 7
script/changelog View File

@ -115,6 +115,8 @@ class _ChangeMeta:
@classmethod
def get(cls, filepath, data):
if 'pr' in data:
return data['pr'], datetime(year=1970, month=1, day=1)
if cls._pr_cache is None:
result = run(
[
@ -148,12 +150,7 @@ class _ChangeMeta:
return cls._pr_cache[filepath]
except KeyError:
# couldn't find a PR with the changelog file in it
try:
# if a PR number was specified in the changelog entry use it
return data['pr'], datetime(year=1970, month=1, day=1)
except KeyError:
# otherwise just give up
return None, datetime(year=1970, month=1, day=1)
return None, datetime(year=1970, month=1, day=1)
def _get_changelogs():
@ -182,7 +179,7 @@ def _get_changelogs():
}
)
ordering = {'major': 0, 'minor': 1, 'patch': 2, 'none': 3, '': 3}
ordering = {'major': 3, 'minor': 2, 'patch': 1, 'none': 0, '': 0}
ret.sort(key=lambda c: (ordering[c['type']], c['time']), reverse=True)
return ret


Loading…
Cancel
Save