Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if changelog.versions:
last_version = changelog.versions[0]
print >> sys.stderr, "INFO: Last version is '%s'." % (
last_version.name)
try:
last_tag = gitlab.get(
'repository/tags/%s' % last_version.name
)
except:
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
if changelog.versions:
last_version = changelog.versions[0]
print >> sys.stderr, "INFO: Last version is '%s'." % (
last_version.name)
try:
last_tag = gitlab.get(
'repository/tags/%s' % last_version.name
)
except:
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