summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@macaw.me>2020-06-19 19:42:17 +0800
committerFrederick Yin <fkfd@macaw.me>2020-06-19 19:59:14 +0800
commit7f6773e33ecc5faf451e55b0bb679f9a6730046d (patch)
treee1cabddd7d2509a9e5cd45fe7451882bbe54e48f
parent1c8d1a0f2e017c8375e080d691dc2f0af10dd9ae (diff)
Show time and view tree in log view
-rw-r--r--git-gmi/git.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/git-gmi/git.py b/git-gmi/git.py
index 2b7fc33..ca8be4b 100644
--- a/git-gmi/git.py
+++ b/git-gmi/git.py
@@ -1,5 +1,6 @@
from pygit2 import *
from hurry.filesize import size, alternative
+from datetime import datetime
import mimetypes
from const import *
from config import *
@@ -72,7 +73,12 @@ class GitGmiRepo:
response = f"{STATUS_SUCCESS} {META_GEMINI}\n" + self.generate_header()
log = self.get_commit_log()
for cmt in log:
- response += f"## {cmt['short_id']} - {cmt['author']}\n{cmt['msg']}\n\n"
+ time = str(datetime.utcfromtimestamp(cmt["time"])) + " UTC"
+ response += (
+ f"## {cmt['short_id']} - {cmt['author']} - {time}\n"
+ f"=> tree/{cmt['short_id']}/ view tree\n"
+ f"{cmt['msg']}\n\n"
+ )
return response
@classmethod