Skip to content

Commit

Permalink
Merge pull request #13 from xingren23/main
Browse files Browse the repository at this point in the history
fix: check udpates
  • Loading branch information
Nourepide authored Nov 24, 2023
2 parents 6ab3881 + abbbc94 commit 7236857
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions Loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,32 +94,33 @@ def check_updates(self):
if self.__config()["updates"]["check_updates"]:
try:
import git
except ImportError:
self.__error("GitPython is not installed.")
return
from git import Repo

from git import Repo
# noinspection PyTypeChecker, PyUnboundLocalVariable
repo = Repo(self.__root_path, odbt=git.db.GitDB)
current_commit = repo.head.commit.hexsha

# noinspection PyTypeChecker, PyUnboundLocalVariable
repo = Repo(self.__root_path, odbt=git.db.GitDB)
current_commit = repo.head.commit.hexsha
repo.remotes.origin.fetch()

repo.remotes.origin.fetch()
# noinspection PyUnresolvedReferences
branch_name = self.__config()["updates"]["branch_name"]
latest_commit = getattr(repo.remotes.origin.refs, branch_name).commit.hexsha

# noinspection PyUnresolvedReferences
branch_name = self.__config()["updates"]["branch_name"]
latest_commit = getattr(repo.remotes.origin.refs, branch_name).commit.hexsha
if current_commit == latest_commit:
if self.__config()["updates"]["notify_if_no_new_updates"]:
self.__notification("No new updates.")
else:
if self.__config()["updates"]["notify_if_has_new_updates"]:
self.__notification("New updates are available.")

if current_commit == latest_commit:
if self.__config()["updates"]["notify_if_no_new_updates"]:
self.__notification("No new updates.")
else:
if self.__config()["updates"]["notify_if_has_new_updates"]:
self.__notification("New updates are available.")
if self.__config()["updates"]["auto_update"]:
repo.remotes.origin.pull()
self.__notification("Update complete.")
except ImportError:
self.__error("GitPython is not installed.")
return

if self.__config()["updates"]["auto_update"]:
repo.remotes.origin.pull()
self.__notification("Update complete.")


def setup_rembg(self):
os.environ["U2NET_HOME"] = folder_paths.models_dir + "/onnx"
Expand Down

0 comments on commit 7236857

Please sign in to comment.