From 1b66898fea0524a80c6021e4167e1f4a5411460f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Kala?= <32958076+lovec741@users.noreply.github.com> Date: Sun, 13 Oct 2024 05:18:19 +0200 Subject: [PATCH] Limited loaded commit messages to 10 --- src/app.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/app.py b/src/app.py index 775d1d8..99dd9c7 100644 --- a/src/app.py +++ b/src/app.py @@ -77,12 +77,15 @@ def archive(): def info(repo: Repository): logs = repo.logger.getLogs() formatted_logs = [] - for log in logs: - commit_hash = log[1].split()[0][1:] - try: - commit_msg, commit_author, commit_url = repo.get_commit_info(commit_hash) - formatted_commit_info = f"#{commit_hash}: {commit_msg} (by {commit_author})" - except Exception as e: + for i, log in enumerate(logs): + if i < 10: + commit_hash = log[1].split()[0][1:] + try: + commit_msg, commit_author, commit_url = repo.get_commit_info(commit_hash) + formatted_commit_info = f"#{commit_hash}: {commit_msg} (by {commit_author})" + except Exception as e: + formatted_commit_info = '' + else: formatted_commit_info = '' formatted_logs.append((log[0], log[1], log[2], formatted_commit_info))