print ComfyUI revision

This commit is contained in:
Dr.Lt.Data 2023-05-23 11:28:43 +09:00
parent c3bdb524b4
commit b7b8545632

View File

@ -16,7 +16,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.6)") print("### Loading: ComfyUI-Manager (V0.6.1)")
comfy_path = os.path.dirname(folder_paths.__file__) comfy_path = os.path.dirname(folder_paths.__file__)
custom_nodes_path = os.path.join(comfy_path, 'custom_nodes') custom_nodes_path = os.path.join(comfy_path, 'custom_nodes')
@ -30,6 +30,25 @@ local_db_extension_node_mappings = os.path.join(comfyui_manager_path, "extension
git_script_path = os.path.join(os.path.dirname(__file__), "git_helper.py") git_script_path = os.path.join(os.path.dirname(__file__), "git_helper.py")
def print_comfyui_version():
try:
repo = git.Repo(os.path.dirname(folder_paths.__file__))
revision_count = len(list(repo.iter_commits('HEAD')))
current_branch = repo.active_branch.name
git_hash = repo.head.commit.hexsha
if current_branch == "master":
print(f"### ComfyUI Revision: {revision_count} [{git_hash[:8]}]")
else:
print(f"### ComfyUI Revision: {revision_count} on '{current_branch}' [{git_hash[:8]}]")
except:
print("### ComfyUI Revision: UNKNOWN (The currently installed ComfyUI is not a Git repository)")
print_comfyui_version()
# use subprocess to avoid file system lock by git (Windows) # use subprocess to avoid file system lock by git (Windows)
def __win_check_git_update(path): def __win_check_git_update(path):
command = [sys.executable, git_script_path, "--check", path] command = [sys.executable, git_script_path, "--check", path]