mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
🎨 代码格式化
This commit is contained in:
parent
3c865c6eb7
commit
ab7aad0488
@ -187,9 +187,7 @@ class AliyunCodeupManager(BaseRepoManager):
|
|||||||
result = FileDownloadResult(
|
result = FileDownloadResult(
|
||||||
repo_type=RepoType.ALIYUN,
|
repo_type=RepoType.ALIYUN,
|
||||||
repo_name=repo_url.split("/")[-1].replace(".git", ""),
|
repo_name=repo_url.split("/")[-1].replace(".git", ""),
|
||||||
owner=self.config.aliyun_codeup.organization_id,
|
|
||||||
file_path=file_path,
|
file_path=file_path,
|
||||||
local_path=str(local_path),
|
|
||||||
version=branch,
|
version=branch,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -212,9 +210,7 @@ class AliyunCodeupManager(BaseRepoManager):
|
|||||||
return FileDownloadResult(
|
return FileDownloadResult(
|
||||||
repo_type=RepoType.ALIYUN,
|
repo_type=RepoType.ALIYUN,
|
||||||
repo_name=repo_name,
|
repo_name=repo_name,
|
||||||
owner=self.config.aliyun_codeup.organization_id,
|
|
||||||
file_path=file_path,
|
file_path=file_path,
|
||||||
local_path=str(local_path),
|
|
||||||
version=branch,
|
version=branch,
|
||||||
error_message=str(e),
|
error_message=str(e),
|
||||||
)
|
)
|
||||||
@ -225,9 +221,7 @@ class AliyunCodeupManager(BaseRepoManager):
|
|||||||
return FileDownloadResult(
|
return FileDownloadResult(
|
||||||
repo_type=RepoType.ALIYUN,
|
repo_type=RepoType.ALIYUN,
|
||||||
repo_name=repo_name,
|
repo_name=repo_name,
|
||||||
owner=self.config.aliyun_codeup.organization_id,
|
|
||||||
file_path=file_path,
|
file_path=file_path,
|
||||||
local_path=str(local_path),
|
|
||||||
version=branch,
|
version=branch,
|
||||||
error_message=str(e),
|
error_message=str(e),
|
||||||
)
|
)
|
||||||
@ -321,16 +315,13 @@ class AliyunCodeupManager(BaseRepoManager):
|
|||||||
"authored_date", datetime.now().isoformat()
|
"authored_date", datetime.now().isoformat()
|
||||||
).replace("Z", "+00:00")
|
).replace("Z", "+00:00")
|
||||||
|
|
||||||
commit_info = RepoCommitInfo(
|
return RepoCommitInfo(
|
||||||
commit_id=id_value,
|
commit_id=id_value,
|
||||||
message=message_value,
|
message=message_value,
|
||||||
author=author_value,
|
author=author_value,
|
||||||
commit_time=datetime.fromisoformat(date_value),
|
commit_time=datetime.fromisoformat(date_value),
|
||||||
changed_files=[], # 阿里云API可能没有直接提供变更文件列表
|
changed_files=[], # 阿里云API可能没有直接提供变更文件列表
|
||||||
)
|
)
|
||||||
|
|
||||||
return commit_info
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"获取提交信息失败: {e}")
|
logger.error(f"获取提交信息失败: {e}")
|
||||||
return None
|
return None
|
||||||
@ -416,11 +407,7 @@ class AliyunCodeupManager(BaseRepoManager):
|
|||||||
|
|
||||||
# 获取两个提交之间的差异
|
# 获取两个提交之间的差异
|
||||||
try:
|
try:
|
||||||
# 这里需要实现从阿里云获取提交差异的逻辑
|
return []
|
||||||
# 由于AliyunFileInfo可能没有get_commit_diff_files方法 这里提供一个简单的实现
|
|
||||||
# 实际上应该调用阿里云API获取提交差异
|
|
||||||
files = [] # 这里应该是从阿里云API获取的文件列表
|
|
||||||
return files
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"获取提交差异失败: {e}")
|
logger.error(f"获取提交差异失败: {e}")
|
||||||
raise RepoUpdateError(f"获取提交差异失败: {e}")
|
raise RepoUpdateError(f"获取提交差异失败: {e}")
|
||||||
|
|||||||
@ -172,6 +172,7 @@ class GithubManager(BaseRepoManager):
|
|||||||
返回:
|
返回:
|
||||||
FileDownloadResult: 下载结果
|
FileDownloadResult: 下载结果
|
||||||
"""
|
"""
|
||||||
|
repo_name = repo_url.split("/")[-1].replace(".git", "").strip()
|
||||||
try:
|
try:
|
||||||
# 解析仓库URL
|
# 解析仓库URL
|
||||||
repo_info = GithubUtils.parse_github_url(repo_url)
|
repo_info = GithubUtils.parse_github_url(repo_url)
|
||||||
@ -181,9 +182,7 @@ class GithubManager(BaseRepoManager):
|
|||||||
result = FileDownloadResult(
|
result = FileDownloadResult(
|
||||||
repo_type=RepoType.GITHUB,
|
repo_type=RepoType.GITHUB,
|
||||||
repo_name=repo_info.repo,
|
repo_name=repo_info.repo,
|
||||||
owner=repo_info.owner,
|
|
||||||
file_path=file_path,
|
file_path=file_path,
|
||||||
local_path=str(local_path),
|
|
||||||
version=branch,
|
version=branch,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -201,10 +200,8 @@ class GithubManager(BaseRepoManager):
|
|||||||
logger.error("下载文件失败", LOG_COMMAND, e=e)
|
logger.error("下载文件失败", LOG_COMMAND, e=e)
|
||||||
return FileDownloadResult(
|
return FileDownloadResult(
|
||||||
repo_type=RepoType.GITHUB,
|
repo_type=RepoType.GITHUB,
|
||||||
repo_name=repo_url.split("/")[-1] if "/" in repo_url else repo_url,
|
repo_name=repo_name,
|
||||||
owner=repo_url.split("/")[-2] if "/" in repo_url else "unknown",
|
|
||||||
file_path=file_path,
|
file_path=file_path,
|
||||||
local_path=str(local_path),
|
|
||||||
version=branch,
|
version=branch,
|
||||||
error_message=str(e),
|
error_message=str(e),
|
||||||
)
|
)
|
||||||
@ -212,10 +209,8 @@ class GithubManager(BaseRepoManager):
|
|||||||
logger.error("下载文件失败", LOG_COMMAND, e=e)
|
logger.error("下载文件失败", LOG_COMMAND, e=e)
|
||||||
return FileDownloadResult(
|
return FileDownloadResult(
|
||||||
repo_type=RepoType.GITHUB,
|
repo_type=RepoType.GITHUB,
|
||||||
repo_name=repo_url.split("/")[-1] if "/" in repo_url else repo_url,
|
repo_name=repo_name,
|
||||||
owner=repo_url.split("/")[-2] if "/" in repo_url else "unknown",
|
|
||||||
file_path=file_path,
|
file_path=file_path,
|
||||||
local_path=str(local_path),
|
|
||||||
version=branch,
|
version=branch,
|
||||||
error_message=str(e),
|
error_message=str(e),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -78,7 +78,7 @@ class FileDownloadResult:
|
|||||||
# 仓库名称
|
# 仓库名称
|
||||||
repo_name: str
|
repo_name: str
|
||||||
# 文件路径
|
# 文件路径
|
||||||
file_path: list[tuple[str, Path]]
|
file_path: list[tuple[str, Path]] | str
|
||||||
# 版本
|
# 版本
|
||||||
version: str
|
version: str
|
||||||
# 是否成功
|
# 是否成功
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user