summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@macaw.me>2020-06-19 19:56:23 +0800
committerFrederick Yin <fkfd@macaw.me>2020-06-19 19:59:14 +0800
commit28c21f08f02cd5d14c1e39150f748f94f945bd70 (patch)
tree3a8b711430ee80cae31944eb855c4eeb72d09d39
parent7f6773e33ecc5faf451e55b0bb679f9a6730046d (diff)
Show recent commits in summary
-rw-r--r--git-gmi/git.py9
1 files changed, 9 insertions, 0 deletions
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