✨ feat(update): 移除资源管理器,重构更新逻辑,支持通过ZhenxunRepoManager进行资源和Web UI的更新

This commit is contained in:
HibiKier
2025-08-04 23:32:11 +08:00
parent a3142ad065
commit 70f363c0ce
14 changed files with 562 additions and 1927 deletions
+7 -6
View File
@@ -283,10 +283,11 @@ class BaseRepoManager(ABC):
return result
# 如果目录存在,检查是否是Git仓库
success, _, _ = await run_git_command(
"rev-parse --is-inside-work-tree", cwd=local_path
)
if not success:
# 首先检查目录本身是否有.git文件夹
git_dir = local_path / ".git"
is_git_repo = git_dir.exists() and git_dir.is_dir()
if not is_git_repo:
# 如果不是Git仓库,尝试初始化它
logger.info(f"目录 {local_path} 不是Git仓库,尝试初始化", LOG_COMMAND)
init_success, _, init_stderr = await run_git_command(
@@ -338,7 +339,7 @@ class BaseRepoManager(ABC):
)
# 获取远程更新
logger.info("获取远程更新", LOG_COMMAND)
logger.info(f"获取远程更新: {repo_url}", LOG_COMMAND)
success, _, stderr = await run_git_command("fetch origin", cwd=local_path)
if not success:
return RepoUpdateResult(
@@ -373,7 +374,7 @@ class BaseRepoManager(ABC):
)
# 拉取最新代码
logger.info("拉取最新代码", LOG_COMMAND)
logger.info(f"拉取最新代码: {repo_url}", LOG_COMMAND)
pull_cmd = f"pull origin {branch}"
if force:
pull_cmd = f"fetch --all && git reset --hard origin/{branch}"