How to use the changelog.Release function in changelog

To help you get started, we’ve selected a few changelog examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kylef / maintain / changelog.py View on Github external
changelog = Changelog(headings[0].title)
        headings = headings[1:]
    else:
        raise Exception('Changelog does not start with a level 1 heading, including the changelog name.')

    if any(map(lambda h: h.level == 1, headings)):
        raise Exception('Changelog has multiple level 1 headings.')

    release = None

    for heading in headings:
        if heading.level == 2:
            if release:
                changelog.releases.append(release)

            release = Release(heading.title)
        elif heading.level == 3:
            if not release:
                raise Exception('Level 3 heading was not found within a release (level 2 heading).')

            release.sections.append(Section(heading.title))

    if release:
        changelog.releases.append(release)

    return changelog