diff --git a/specification/00_basis.rst b/specification/00_basis.rst index b7ec349b..ad0688c9 100644 --- a/specification/00_basis.rst +++ b/specification/00_basis.rst @@ -6,7 +6,7 @@ Version: {{spec_version}} This specification has been generated from https://github.com/matrix-org/matrix-doc using https://github.com/matrix-org/matrix-doc/blob/master/scripts/gendoc.py as of -revision ``{{git_version}}``. +revision ``{{git_version}}`` - https://github.com/matrix-org/matrix-doc/tree/{{git_rev}} Changelog ~~~~~~~~~ diff --git a/templating/matrix_templates/sections.py b/templating/matrix_templates/sections.py index 63759755..5e6805b3 100644 --- a/templating/matrix_templates/sections.py +++ b/templating/matrix_templates/sections.py @@ -10,7 +10,10 @@ class MatrixSections(Sections): # pass through git ver so it'll be dropped in the input file def render_git_version(self): - return self.units.get("git_version") + return self.units.get("git_version")["string"] + + def render_git_rev(self): + return self.units.get("git_version")["revision"] def render_spec_version(self): spec_meta = self.units.get("spec_meta") diff --git a/templating/matrix_templates/units.py b/templating/matrix_templates/units.py index 062f3e43..d607160f 100644 --- a/templating/matrix_templates/units.py +++ b/templating/matrix_templates/units.py @@ -455,11 +455,14 @@ class MatrixUnits(Units): except subprocess.CalledProcessError: git_dirty = "" + git_version = "Unknown" if git_branch or git_tag or git_commit or git_dirty: git_version = ",".join( s for s in (git_branch, git_tag, git_commit, git_dirty,) if s - ) - return git_version.encode("ascii") - return "Unknown rev" + ).encode("ascii") + return { + "string": git_version, + "revision": git_commit + }