From 016fe3ef72066bbfb1a410be0da867619c19fec3 Mon Sep 17 00:00:00 2001 From: snowy Date: Mon, 15 Apr 2024 20:43:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=A9=E6=B0=94=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteyuki/liteyuki_main/api.py | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/liteyuki/liteyuki_main/api.py b/liteyuki/liteyuki_main/api.py index f208e560..b7bbd8c9 100644 --- a/liteyuki/liteyuki_main/api.py +++ b/liteyuki/liteyuki_main/api.py @@ -20,41 +20,14 @@ def detect_update() -> bool: def update_liteyuki() -> tuple[bool, str]: """更新轻雪 :return: 是否更新成功,更新变动""" - # 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() - # break - # except Exception as e: - # nonebot.logger.error(f"Pull from {origin} failed: {e}") - # continue - # else: - # return False, 0 - # - # return True, len(logs) + new_commit_detected = detect_update() if new_commit_detected: repo = Repo(".") logs = "" # 对每个远程仓库进行更新 for remote_url in remote_urls: + logs += f"\nremote: {remote_url}" repo.remotes.origin.set_url(remote_url) repo.remotes.origin.pull() diffs = repo.head.commit.diff("origin/main")