How to use the changelog.Version.from_string 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 mistio / mist-ee / changelog.py View on Github external
print >> sys.stderr, ("ERROR: Can't find previous release "
                                      "'%s' on Gitlab." % last_version.name)
                raise
            since = dateutil.parser.parse(last_tag['commit']['committed_date'])
        mrs = get_mrs(gitlab, branches=args.branches, since=since)
        for mr in mrs:
            version.changes.append(Change(mr['title'], mr=mr['iid']))
        text = version.to_string()
        if last_version is not None and last_version.prerelease:
            for change in last_version.changes:
                text += '%s\n' % change.to_string()
            changelog.versions.pop(0)
        while True:
            text = editor(text, tmp_suffix='.md')
            try:
                version = Version.from_string(text)
            except Exception as exc:
                print >> sys.stderr, "WARNING: Error parsing change: %r" % exc
                if not prompt_boolean("Re-edit changelog", default=True):
                    print >> sys.stderr, "ERROR: Exiting."
                    sys.exit(1)
            else:
                break
        changelog.versions.insert(0, version)
        changelog.show()
        if prompt_boolean("Do you wish to update %s?" % args.file):
            changelog.to_file(args.file)
github mistio / mist-ce / changelog.py View on Github external
print >> sys.stderr, ("ERROR: Can't find previous release "
                                      "'%s' on Gitlab." % last_version.name)
                raise
            since = dateutil.parser.parse(last_tag['commit']['committed_date'])
        mrs = get_mrs(gitlab, branches=args.branches, since=since)
        for mr in mrs:
            version.changes.append(Change(mr['title'], mr=mr['iid']))
        text = version.to_string()
        if last_version is not None and last_version.prerelease:
            for change in last_version.changes:
                text += '%s\n' % change.to_string()
            changelog.versions.pop(0)
        while True:
            text = editor(text, tmp_suffix='.md')
            try:
                version = Version.from_string(text)
            except Exception as exc:
                print >> sys.stderr, "WARNING: Error parsing change: %r" % exc
                if not prompt_boolean("Re-edit changelog", default=True):
                    print >> sys.stderr, "ERROR: Exiting."
                    sys.exit(1)
            else:
                break
        changelog.versions.insert(0, version)
        changelog.show()
        if prompt_boolean("Do you wish to update %s?" % args.file):
            changelog.to_file(args.file)
github mistio / mist-ce / changelog.py View on Github external
print >> sys.stderr, "WARNING: Changelog is emtpy"
            return changelog
        assert re.match('^#\s*changelog\s*$',
                        lines[0].lower()), "Changelog missing top header."
        lines = crop_line_padding(lines[1:])
        sections = []
        for line in lines:
            if re.match('^##[^#]', line):
                sections.append([])
            else:
                assert sections, ("Changelog body doesn't start "
                                  "with level two header.")
            sections[-1].append(line)
        for section in sections:
            changelog.versions.append(
                Version.from_string('\n'.join(section))
            )
        return changelog
github mistio / mist-ee / changelog.py View on Github external
print >> sys.stderr, "WARNING: Changelog is emtpy"
            return changelog
        assert re.match('^#\s*changelog\s*$',
                        lines[0].lower()), "Changelog missing top header."
        lines = crop_line_padding(lines[1:])
        sections = []
        for line in lines:
            if re.match('^##[^#]', line):
                sections.append([])
            else:
                assert sections, ("Changelog body doesn't start "
                                  "with level two header.")
            sections[-1].append(line)
        for section in sections:
            changelog.versions.append(
                Version.from_string('\n'.join(section))
            )
        return changelog