From 28c21f08f02cd5d14c1e39150f748f94f945bd70 Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Fri, 19 Jun 2020 19:56:23 +0800 Subject: Show recent commits in summary --- git-gmi/git.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'git-gmi/git.py') diff --git a/git-gmi/git.py b/git-gmi/git.py index ca8be4b..79a59c4 100644 --- a/git-gmi/git.py +++ b/git-gmi/git.py @@ -34,6 +34,15 @@ class GitGmiRepo: def view_summary(self) -> str: response = f"{STATUS_SUCCESS} {META_GEMINI}\n" + self.generate_header() + # show 3 recent commits + recent_commits = self.get_commit_log()[:3] + for cmt in recent_commits: + time = str(datetime.utcfromtimestamp(cmt["time"])) + " UTC" + response += ( + f"### {cmt['short_id']} - {cmt['author']} - {time}\n" + f"{cmt['msg'].splitlines()[0]}\n\n" + ) # TODO: link to commit view + # find and display readme(.*) tree = self.get_tree(MAIN_BRANCH) trls = self.list_tree(tree) found_readme = False -- cgit v1.2.3