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)
| 70 | return (version_num, beta_tag, beta_num) |
| 71 | |
| 72 | def 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 | |
| 91 | def get_changelog_notes(version_num): |
| 92 | with open(CHANGELOG_FILEPATH, 'r') as changelog: |
no outgoing calls
no test coverage detected