mirror of
https://github.com/openvinotoolkit/stable-diffusion-webui.git
synced 2024-12-15 07:03:06 +03:00
rm dir on failed clone, disable autofix for fetch
This commit is contained in:
parent
959404e0e2
commit
5a705c2468
@ -3,6 +3,7 @@ import logging
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import importlib.util
|
import importlib.util
|
||||||
import platform
|
import platform
|
||||||
@ -152,10 +153,8 @@ def run_git(dir, name, command, desc=None, errdesc=None, custom_env=None, live:
|
|||||||
try:
|
try:
|
||||||
return run(f'"{git}" -C "{dir}" {command}', desc=desc, errdesc=errdesc, custom_env=custom_env, live=live)
|
return run(f'"{git}" -C "{dir}" {command}', desc=desc, errdesc=errdesc, custom_env=custom_env, live=live)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
pass
|
if not autofix:
|
||||||
|
raise
|
||||||
if not autofix:
|
|
||||||
return None
|
|
||||||
|
|
||||||
print(f"{errdesc}, attempting autofix...")
|
print(f"{errdesc}, attempting autofix...")
|
||||||
git_fix_workspace(dir, name)
|
git_fix_workspace(dir, name)
|
||||||
@ -174,13 +173,17 @@ def git_clone(url, dir, name, commithash=None):
|
|||||||
if current_hash == commithash:
|
if current_hash == commithash:
|
||||||
return
|
return
|
||||||
|
|
||||||
run_git('fetch', f"Fetching updates for {name}...", f"Couldn't fetch {name}")
|
run_git('fetch', f"Fetching updates for {name}...", f"Couldn't fetch {name}", autofix=False)
|
||||||
|
|
||||||
run_git('checkout', f"Checking out commit for {name} with hash: {commithash}...", f"Couldn't checkout commit {commithash} for {name}", live=True)
|
run_git('checkout', f"Checking out commit for {name} with hash: {commithash}...", f"Couldn't checkout commit {commithash} for {name}", live=True)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
run(f'"{git}" clone "{url}" "{dir}"', f"Cloning {name} into {dir}...", f"Couldn't clone {name}", live=True)
|
try:
|
||||||
|
run(f'"{git}" clone "{url}" "{dir}"', f"Cloning {name} into {dir}...", f"Couldn't clone {name}", live=True)
|
||||||
|
except RuntimeError:
|
||||||
|
shutil.rmtree(dir, ignore_errors=True)
|
||||||
|
raise
|
||||||
|
|
||||||
if commithash is not None:
|
if commithash is not None:
|
||||||
run(f'"{git}" -C "{dir}" checkout {commithash}', None, "Couldn't checkout {name}'s hash: {commithash}")
|
run(f'"{git}" -C "{dir}" checkout {commithash}', None, "Couldn't checkout {name}'s hash: {commithash}")
|
||||||
|
Loading…
Reference in New Issue
Block a user