From 39f43abbb725bf55ffdf3a6141f05e328afa458c Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Mon, 7 Dec 2015 14:24:10 +0000 Subject: [PATCH] Add per-API changelogs --- changelogs/client_server.rst | 10 ++++++++ specification/client_server_api.rst | 13 ++++++++++ templating/matrix_templates/sections.py | 6 ++--- templating/matrix_templates/units.py | 33 ++++++++++++++----------- 4 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 changelogs/client_server.rst diff --git a/changelogs/client_server.rst b/changelogs/client_server.rst new file mode 100644 index 000000000..ef467a3c4 --- /dev/null +++ b/changelogs/client_server.rst @@ -0,0 +1,10 @@ +r0 +=== + +This is the first release of the client-server specification. It is largely a dump of what has currently been implemented, and there are several inconsistencies. + +An upcoming minor release will deprecate many of these inconsistencies, and they will be removed in the next major release. + +Since the draft stage, the following major changes have been made: +- /api/v1 and /v2_alpha path segments have been replaced with the major version of the release (i.e. 'r0'). +- The specification has been split into one specification per API. This is the client-server API. The server-server API can be found documented separately. diff --git a/specification/client_server_api.rst b/specification/client_server_api.rst index ef727ec22..c0db23554 100644 --- a/specification/client_server_api.rst +++ b/specification/client_server_api.rst @@ -10,6 +10,19 @@ local persistent copy of server state. .. contents:: Table of Contents .. sectnum:: +Changelog +--------- + +Version of this specification: **%CLIENT_RELEASE_LABEL%**. + +{{client_server_changelog}} + +For the full historical changelog, see +https://github.com/matrix-org/matrix-doc/blob/master/changelogs/client-server.rst + +If this is an unstable snapshot, any changes since the last release may be +viewed using ``git log``. + API Standards ------------- diff --git a/templating/matrix_templates/sections.py b/templating/matrix_templates/sections.py index d285bb61f..867749bf2 100644 --- a/templating/matrix_templates/sections.py +++ b/templating/matrix_templates/sections.py @@ -15,9 +15,9 @@ class MatrixSections(Sections): def render_git_rev(self): return self.units.get("git_version")["revision"] - def render_spec_changelog(self): - spec_meta = self.units.get("spec_meta") - return spec_meta["changelog"] + def render_client_server_changelog(self): + changelogs = self.units.get("changelogs") + return changelogs["client_server"] def _render_events(self, filterFn, sortFn): template = self.env.get_template("events.tmpl") diff --git a/templating/matrix_templates/units.py b/templating/matrix_templates/units.py index fcd3f7f9d..a2788fda1 100644 --- a/templating/matrix_templates/units.py +++ b/templating/matrix_templates/units.py @@ -21,7 +21,7 @@ HTTP_APIS = ("../api/application-service", "../api/client-server",) EVENT_EXAMPLES = "../event-schemas/examples" EVENT_SCHEMA = "../event-schemas/schema" CORE_EVENT_SCHEMA = "../event-schemas/schema/core-event-schema" -CHANGELOG = "../CHANGELOG.rst" +CHANGELOG_DIR = "../changelogs" TARGETS = "../specification/targets.yaml" ROOM_EVENT = "core-event-schema/room_event.yaml" @@ -711,13 +711,21 @@ class MatrixUnits(Units): schemata[filename] = schema return schemata - def load_spec_meta(self): - path = CHANGELOG - title_part = None - changelog_lines = [] - with open(path, "r") as f: + def load_changelogs(self): + changelogs = {} + + for f in os.listdir(CHANGELOG_DIR): + if not f.endswith(".rst"): + continue + path = os.path.join(CHANGELOG_DIR, f) + name = f[:-4] + + title_part = None + changelog_lines = [] + with open(path, "r") as f: + lines = f.readlines() prev_line = None - for line in f.readlines(): + for line in lines: if line.strip().startswith(".. "): continue # comment if prev_line is None: @@ -735,15 +743,10 @@ class MatrixUnits(Units): # then bail out. changelog_lines.pop() break - changelog_lines.append(line) + changelog_lines.append(" " + line) + changelogs[name] = "\n".join(changelog_lines) - self.log("Title part: %s Changelog line count: %s" % ( - title_part, len(changelog_lines) - )) - - return { - "changelog": "".join(changelog_lines) - } + return changelogs def load_spec_targets(self):