fix: messages

This commit is contained in:
Dr.Lt.Data 2023-09-19 10:14:14 +09:00
parent 7688c08000
commit 0977ef97f3
2 changed files with 36 additions and 28 deletions

View File

@ -55,7 +55,7 @@ sys.path.append('../..')
from torchvision.datasets.utils import download_url from torchvision.datasets.utils import download_url
# ensure .js # ensure .js
print("### Loading: ComfyUI-Manager (V0.28.2)") print("### Loading: ComfyUI-Manager (V0.28.3)")
comfy_ui_required_revision = 1240 comfy_ui_required_revision = 1240
comfy_ui_revision = "Unknown" comfy_ui_revision = "Unknown"
@ -251,21 +251,24 @@ def __win_check_git_update(path, do_fetch=False, do_update=False):
if do_update: if do_update:
if "CUSTOM NODE PULL: True" in output: if "CUSTOM NODE PULL: True" in output:
process.wait() process.wait()
print(f"\rUpdated: '{path}'") print(f"\rUpdated: {path}")
return True return True
elif "CUSTOM NODE PULL: None" in output: elif "CUSTOM NODE PULL: None" in output:
process.wait() process.wait()
return True return True
else: else:
print(f"{output}") print(f"\rUpdate error: {path}")
process.wait() process.wait()
return False return False
else: else:
if "CUSTOM NODE CHECK: True" in output: if "CUSTOM NODE CHECK: True" in output:
process.wait() process.wait()
return True return True
elif "CUSTOM NODE CHECK: False" in output:
process.wait()
return False
else: else:
print(f"{output}") print(f"\rFetch error: {path}")
process.wait() process.wait()
return False return False
@ -278,9 +281,9 @@ def __win_check_git_pull(path):
def git_repo_has_updates(path, do_fetch=False, do_update=False): def git_repo_has_updates(path, do_fetch=False, do_update=False):
if do_fetch: if do_fetch:
print(f"\rFetching: {path}", end='') print(f"\x1b[2K\rFetching: {path}", end='')
elif do_update: elif do_update:
print(f"\rUpdating: {path}", end='') print(f"\x1b[2K\rUpdating: {path}", end='')
# Check if the path is a git repository # Check if the path is a git repository
if not os.path.exists(os.path.join(path, '.git')): if not os.path.exists(os.path.join(path, '.git')):
@ -311,7 +314,7 @@ def git_repo_has_updates(path, do_fetch=False, do_update=False):
new_commit_hash = repo.head.commit.hexsha new_commit_hash = repo.head.commit.hexsha
if commit_hash != new_commit_hash: if commit_hash != new_commit_hash:
print(f"\rUpdated: '{path}'") print(f"\x1b[2K\rUpdated: '{path}'")
except Exception as e: except Exception as e:
print(f"Updating failed: '{path}'\n{e}") print(f"Updating failed: '{path}'\n{e}")

View File

@ -12,33 +12,38 @@ def gitclone(custom_nodes_path, url):
repo.close() repo.close()
def gitcheck(path, do_fetch=False): def gitcheck(path, do_fetch=False):
# Fetch the latest commits from the remote repository try:
repo = git.Repo(path) # Fetch the latest commits from the remote repository
repo = git.Repo(path)
current_branch = repo.active_branch current_branch = repo.active_branch
branch_name = current_branch.name branch_name = current_branch.name
remote_name = 'origin' remote_name = 'origin'
remote = repo.remote(name=remote_name) remote = repo.remote(name=remote_name)
if do_fetch: if do_fetch:
remote.fetch() remote.fetch()
# Get the current commit hash and the commit hash of the remote branch # Get the current commit hash and the commit hash of the remote branch
commit_hash = repo.head.commit.hexsha commit_hash = repo.head.commit.hexsha
remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha
# Compare the commit hashes to determine if the local repository is behind the remote repository # Compare the commit hashes to determine if the local repository is behind the remote repository
if commit_hash != remote_commit_hash: if commit_hash != remote_commit_hash:
# Get the commit dates # Get the commit dates
commit_date = repo.head.commit.committed_datetime commit_date = repo.head.commit.committed_datetime
remote_commit_date = repo.refs[f'{remote_name}/{branch_name}'].object.committed_datetime remote_commit_date = repo.refs[f'{remote_name}/{branch_name}'].object.committed_datetime
# Compare the commit dates to determine if the local repository is behind the remote repository
if commit_date < remote_commit_date:
print("CUSTOM NODE CHECK: True")
else:
print("CUSTOM NODE CHECK: False")
except Exception as e:
print(e)
print("CUSTOM NODE CHECK: Error")
# Compare the commit dates to determine if the local repository is behind the remote repository
if commit_date < remote_commit_date:
print("CUSTOM NODE CHECK: True")
else:
print("CUSTOM NODE CHECK: False")
def gitpull(path): def gitpull(path):
# Check if the path is a git repository # Check if the path is a git repository