MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / get_version_notes

Function get_version_notes

Scripts/get-release-notes.py:72–89  ·  view source on GitHub ↗

r''' Returns the portion of the given changelog that corresponds to the changes for the given version number. version_num is expected to be stripped of any beta info This won't work for the last version number in a file, but that's fine >>> get_version_notes('1.2', '# Unrar

(version_num, changes)

Source from the content-addressed store, hash-verified

70 return (version_num, beta_tag, beta_num)
71
72def get_version_notes(version_num, changes):
73 r'''
74 Returns the portion of the given changelog that corresponds to the changes for the given
75 version number. version_num is expected to be stripped of any beta info
76
77 This won't work for the last version number in a file, but that's fine
78
79 >>> get_version_notes('1.2', '# UnrarKit CHANGELOG\n\n## 1.2\n\nList of changes\n\n## 1.1\n\nMore changes\n\n## 1.0')
80 'List of changes'
81
82 >>> get_version_notes('1.1', '# UnrarKit CHANGELOG\n\n## 1.2\n\nList of changes\n\n## 1.1\n\nMore changes\n\n## 1.0')
83 'More changes'
84 '''
85
86 notes_regex = r'##\s+{}\s+(.+?)\s+(?:##\s+[\d\.]+).*'.format(version_num.replace('.', '\.'))
87 matches = re.search(notes_regex, changes, re.DOTALL)
88
89 return matches[1].strip()
90
91def get_changelog_notes(version_num):
92 with open(CHANGELOG_FILEPATH, 'r') as changelog:

Callers 1

get_changelog_notesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected