Skip to content

feat:为下载器添加Git LFS文件拉取进度条#3485

Merged
donghaiwang merged 2 commits intoOpenHUTB:hutbfrom
Utopia-qwerty:hutb
Mar 19, 2026
Merged

feat:为下载器添加Git LFS文件拉取进度条#3485
donghaiwang merged 2 commits intoOpenHUTB:hutbfrom
Utopia-qwerty:hutb

Conversation

@Utopia-qwerty
Copy link
Contributor

  • 测试截图如下
PixPin_2026-03-18_22-52-46 PixPin_2026-03-18_22-52-58

Copilot AI review requested due to automatic review settings March 18, 2026 15:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 旨在改进 Util/download_from_git.py 下载器:在拉取大文件仓库(含 Git LFS 对象)时提供更友好的下载过程展示,并在文件切分/合并/解压阶段增加控制台进度显示,以提升可用性与可观测性。

Changes:

  • 将仓库克隆流程改为通过 subprocess 调用 git clone,并新增 Git LFS 初始化与拉取逻辑。
  • 新增通用 show_progress_bar(),在切分 .zip.dat、合并 .dat、删除 .dat、解压 .zip 等环节显示进度条。
  • 调整若干路径/字符串风格与注释格式,增强脚本输出信息。

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +125 to +136
# 先用 --no-checkout 克隆,避免因LFS未初始化而失败
clone_cmd = [
git_exe,
"clone",
"--depth",
"1",
"-b",
branch,
"--no-checkout",
repo_url,
self.local_path,
]
Comment on lines +141 to +146
stderr=subprocess.DEVNULL,
)
if result.returncode != 0:
raise Exception(
f"Git clone failed with return code {result.returncode}"
)
Comment on lines +317 to +319
files = sorted(
[f for f in files if f.endswith(".dat")],
key=lambda x: int(x.split("_")[1].split(".")[0]),
Comment on lines +400 to +402
if os.path.exists(os.path.join(local_path, latest_file)):
os.rename(
os.path.join(local_path, latest_file),
Comment on lines +405 to +408
if os.path.exists(os.path.join(rep_path, "*.dat")) is False:
split_file(
os.path.join(local_path, "hutb.zip"), rep_path, 256 * 1024 * 1024
) # 每个小文件最大为 256MB
@donghaiwang donghaiwang merged commit 2b636e3 into OpenHUTB:hutb Mar 19, 2026
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants