feat(config): 修改错误提示信息,更新基础配置文件名称为.env.example
Some checks are pending
Sequential Lint and Type Check / ruff-call (push) Waiting to run
Sequential Lint and Type Check / pyright-call (push) Blocked by required conditions

This commit is contained in:
HibiKier 2025-08-01 10:01:34 +08:00
parent 6c136b904d
commit c9456f292d
2 changed files with 30 additions and 8 deletions

View File

@ -40,7 +40,7 @@ async def _(setting: Setting) -> Result:
return Result.fail("配置已存在请先删除DB_URL内容和前端密码再进行设置。") return Result.fail("配置已存在请先删除DB_URL内容和前端密码再进行设置。")
env_file = Path() / ".env.example" env_file = Path() / ".env.example"
if not env_file.exists(): if not env_file.exists():
return Result.fail("配置文件.env.dev不存在。") return Result.fail("基础配置文件.env.example不存在。")
env_text = env_file.read_text(encoding="utf-8") env_text = env_file.read_text(encoding="utf-8")
to_env_file = Path() / ".env.dev" to_env_file = Path() / ".env.dev"
if setting.db_url: if setting.db_url:

View File

@ -287,14 +287,36 @@ class BaseRepoManager(ABC):
"rev-parse --is-inside-work-tree", cwd=local_path "rev-parse --is-inside-work-tree", cwd=local_path
) )
if not success: if not success:
return RepoUpdateResult( # 如果不是Git仓库尝试初始化它
repo_type=repo_type or RepoType.GITHUB, logger.info(f"目录 {local_path} 不是Git仓库尝试初始化", LOG_COMMAND)
repo_name=repo_name, init_success, _, init_stderr = await run_git_command(
owner=owner or "", "init", cwd=local_path
old_version="",
new_version="",
error_message=f"{local_path} 不是一个Git仓库",
) )
if not init_success:
return RepoUpdateResult(
repo_type=repo_type or RepoType.GITHUB,
repo_name=repo_name,
owner=owner or "",
old_version="",
new_version="",
error_message=f"初始化Git仓库失败: {init_stderr}",
)
# 添加远程仓库
remote_success, _, remote_stderr = await run_git_command(
f"remote add origin {repo_url}", cwd=local_path
)
if not remote_success:
return RepoUpdateResult(
repo_type=repo_type or RepoType.GITHUB,
repo_name=repo_name,
owner=owner or "",
old_version="",
new_version="",
error_message=f"添加远程仓库失败: {remote_stderr}",
)
logger.info(f"成功初始化Git仓库 {local_path}", LOG_COMMAND)
# 获取当前提交ID作为旧版本 # 获取当前提交ID作为旧版本
success, old_version, _ = await run_git_command( success, old_version, _ = await run_git_command(