Fix changelog generation for non-default versions

Currently if you generate a changelog for r0.1.1 of an API, you'd get "No significant changes" which is wrong. You should get a real changelog for the version.

This is now handled by generating a "preferred" changelog which acts as the default for version variables in the RST. Using a specific version's changelog is still supported for the rare cases where that is desired.
pull/977/head
Travis Ralston 6 years ago
parent baf00ba6d1
commit 54ee861b5f

@ -41,7 +41,7 @@ class MatrixSections(Sections):
version_var = "%s_%s" % (spec_var, version)
logger.info("Rendering changelog for %s" % version_var)
rendered[version_var] = changelog
if version == "unstable":
if version == "preferred":
rendered[spec_var] = changelog
return rendered

@ -903,9 +903,17 @@ class MatrixUnits(Units):
return schema
def load_changelogs(self):
def load_changelogs(self, substitutions):
changelogs = {}
preferred_versions = {
"server_server": substitutions.get("%SERVER_RELEASE_LABEL%", "unstable"),
"client_server": substitutions.get("%CLIENT_RELEASE_LABEL%", "unstable"),
"identity_service": substitutions.get("%IDENTITY_RELEASE_LABEL%", "unstable"),
"push_gateway": substitutions.get("%PUSH_GATEWAY_RELEASE_LABEL%", "unstable"),
"application_service": substitutions.get("%APPSERVICE_RELEASE_LABEL%", "unstable"),
}
# Changelog generation is a bit complicated. We rely on towncrier to
# generate the unstable/current changelog, but otherwise use the RST
# edition to record historical changelogs. This is done by prepending
@ -1007,6 +1015,10 @@ class MatrixUnits(Units):
title_part = keyword_versions[title_part]
changelog = "".join(changelog_lines)
changelogs[name][title_part.replace("^[a-zA-Z0-9]", "_").lower()] = changelog
preferred_changelog = changelogs[name]["unstable"]
if name in preferred_versions:
preferred_changelog = changelogs[name][preferred_versions[name]]
changelogs[name]["preferred"] = preferred_changelog
return changelogs

Loading…
Cancel
Save