diff --git a/model_diffsummary/__main__.py b/model_diffsummary/__main__.py index 7ec4470..78c0bae 100644 --- a/model_diffsummary/__main__.py +++ b/model_diffsummary/__main__.py @@ -3,6 +3,7 @@ """Main entry point into model_diffsummary.""" from __future__ import annotations +import datetime import logging import typing as t @@ -11,6 +12,7 @@ import markupsafe import yaml from capellambse import model as m +from capellambse.filehandler import git as gitfh from capellambse.model import common as c import model_diffsummary @@ -69,10 +71,21 @@ def _get_revision_info( ) -> types.RevisionInfo: """Return the revision info of the given model.""" info = model.info + fh = model._loader.resources["\x00"] + assert isinstance(fh, gitfh.GitFileHandler) + author, date_str, description = fh._git( + "log", + "-1", + "--format=%aN%x00%aI%x00%B", + info.rev_hash, + encoding="utf-8", + ).split("\x00") return { "hash": info.rev_hash, "revision": revision, - # TODO add author, date, description from commit + "author": author, + "date": datetime.datetime.fromisoformat(date_str), + "description": description.rstrip(), }