| import os |
|
|
| |
| repositories = [ |
| ("https://gitcode.net/overbill1683/stablediffusion", "stable-diffusion-stability-ai"), |
| ("https://gitcode.net/overbill1683/taming-transformers", "taming-transformers"), |
| ("https://gitcode.net/overbill1683/k-diffusion", "k-diffusion"), |
| ("https://gitcode.net/overbill1683/CodeFormer", "CodeFormer"), |
| ("https://gitcode.net/overbill1683/BLIP", "BLIP") |
| ] |
|
|
| def update_repositories(): |
| workspace_path = "/mnt/workspace/stable-diffusion-webui" |
| |
| |
| os.chdir(workspace_path) |
| |
| |
| os.system("git pull") |
| |
| |
| os.chdir(os.path.join(workspace_path, "repositories")) |
| for repo_url, repo_dir in repositories: |
| repo_path = os.path.join(workspace_path, "repositories", repo_dir) |
| |
| if os.path.exists(repo_path): |
| |
| os.chdir(repo_path) |
| |
| |
| os.system("git fetch") |
| |
| |
| diff_output = os.popen("git diff HEAD..origin/master").read().strip() |
| |
| if diff_output: |
| |
| os.system("git pull") |
| print(f"子仓库 {repo_dir} 更新成功!") |
| else: |
| print(f"子仓库 {repo_dir} 已经是最新的,无需更新。") |
| else: |
| |
| os.chdir(workspace_path) |
| os.system(f"git clone {repo_url} {repo_dir}") |
| print(f"成功克隆子仓库 {repo_dir}!") |
| |
| |
| os.system("wget -O config.json https://gitcode.net/Akegarasu/sd-webui-configs/-/raw/master/config.json") |
| print("配置文件下载成功!") |
|
|
| if __name__ == "__main__": |
| update_repositories() |
| print("主仓库和子仓库更新完成。") |
|
|