From ad543dd73846a2179b68ae9ded03fbc79b522845 Mon Sep 17 00:00:00 2001 From: snowy Date: Wed, 3 Apr 2024 14:57:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9B=BD=E4=BA=A7=E6=9F=90=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E8=BD=AF=E4=BB=B6=E7=9A=84=E5=9B=BE=E5=BA=8A=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteyuki/liteyuki_main/core.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/liteyuki/liteyuki_main/core.py b/liteyuki/liteyuki_main/core.py index 4fec7de..eab375b 100644 --- a/liteyuki/liteyuki_main/core.py +++ b/liteyuki/liteyuki_main/core.py @@ -83,6 +83,22 @@ async def _(bot: T_Bot, event: T_MessageEvent): ulang = get_user_lang(str(event.user_id)) origins = ["origin", "origin2"] repo = Repo(".") + + # Get the current HEAD commit + current_head_commit = repo.head.commit + + # Fetch the latest information from the cloud + repo.remotes.origin.fetch() + + # Get the latest HEAD commit + new_head_commit = repo.commit('origin/main') + + # If the new HEAD commit is different from the current HEAD commit, there is a new commit + diffs = current_head_commit.diff(new_head_commit) + logs = "" + for diff in diffs.iter_change_type('M'): + logs += f"\n{diff.a_path}" + for origin in origins: try: repo.remotes[origin].pull()