diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-07-08 12:10:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-08 12:10:10 +0000 |
commit | ec9bbda3da846b4aa2f03b1e0f0952ffbc61f4f6 (patch) | |
tree | 5ae676b6ac7242ad082ab7421cf8ae9d50d52818 /modules/extensions.py | |
parent | c4c63dd5e4760c56405cef2e71abc5c3604c4578 (diff) | |
parent | 18256c5f0174126cb103afece2b39b6b831e034a (diff) | |
download | stable-diffusion-webui-gfx803-ec9bbda3da846b4aa2f03b1e0f0952ffbc61f4f6.tar.gz stable-diffusion-webui-gfx803-ec9bbda3da846b4aa2f03b1e0f0952ffbc61f4f6.tar.bz2 stable-diffusion-webui-gfx803-ec9bbda3da846b4aa2f03b1e0f0952ffbc61f4f6.zip |
Merge branch 'dev' into img2img-batch-png-info
Diffstat (limited to 'modules/extensions.py')
-rw-r--r-- | modules/extensions.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/modules/extensions.py b/modules/extensions.py index 624832a0..abc6e2b1 100644 --- a/modules/extensions.py +++ b/modules/extensions.py @@ -1,17 +1,13 @@ import os
-import sys
import threading
-import traceback
-import git
-
-from modules import shared
+from modules import shared, errors
+from modules.gitpython_hack import Repo
from modules.paths_internal import extensions_dir, extensions_builtin_dir, script_path # noqa: F401
extensions = []
-if not os.path.exists(extensions_dir):
- os.makedirs(extensions_dir)
+os.makedirs(extensions_dir, exist_ok=True)
def active():
@@ -54,10 +50,9 @@ class Extension: repo = None
try:
if os.path.exists(os.path.join(self.path, ".git")):
- repo = git.Repo(self.path)
+ repo = Repo(self.path)
except Exception:
- print(f"Error reading github repository info from {self.path}:", file=sys.stderr)
- print(traceback.format_exc(), file=sys.stderr)
+ errors.report(f"Error reading github repository info from {self.path}", exc_info=True)
if repo is None or repo.bare:
self.remote = None
@@ -72,8 +67,8 @@ class Extension: self.commit_hash = commit.hexsha
self.version = self.commit_hash[:8]
- except Exception as ex:
- print(f"Failed reading extension data from Git repository ({self.name}): {ex}", file=sys.stderr)
+ except Exception:
+ errors.report(f"Failed reading extension data from Git repository ({self.name})", exc_info=True)
self.remote = None
self.have_info_from_repo = True
@@ -94,7 +89,7 @@ class Extension: return res
def check_updates(self):
- repo = git.Repo(self.path)
+ repo = Repo(self.path)
for fetch in repo.remote().fetch(dry_run=True):
if fetch.flags != fetch.HEAD_UPTODATE:
self.can_update = True
@@ -116,7 +111,7 @@ class Extension: self.status = "latest"
def fetch_and_reset_hard(self, commit='origin'):
- repo = git.Repo(self.path)
+ repo = Repo(self.path)
# Fix: `error: Your local changes to the following files would be overwritten by merge`,
# because WSL2 Docker set 755 file permissions instead of 644, this results to the error.
repo.git.fetch(all=True)
|