From 25969d2ac7fcc42cf9f09047deca60ad096094d7 Mon Sep 17 00:00:00 2001 From: "dr.lt.data" Date: Mon, 5 Feb 2024 12:40:32 +0900 Subject: [PATCH] better version reporting --- __init__.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/__init__.py b/__init__.py index 0fa384f..44dd693 100644 --- a/__init__.py +++ b/__init__.py @@ -29,7 +29,7 @@ except: print(f"[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.") -version = [2, 7] +version = [2, 7, 1] version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '') print(f"### Loading: ComfyUI-Manager ({version_str})") @@ -307,16 +307,19 @@ def print_comfyui_version(): global comfy_ui_commit_datetime global comfy_ui_hash + is_detached = False try: repo = git.Repo(os.path.dirname(folder_paths.__file__)) - comfy_ui_revision = len(list(repo.iter_commits('HEAD'))) - current_branch = repo.active_branch.name - comfy_ui_hash = repo.head.commit.hexsha + comfy_ui_hash = repo.head.commit.hexsha cm_global.variables['comfyui.revision'] = comfy_ui_revision comfy_ui_commit_datetime = repo.head.commit.committed_datetime + cm_global.variables['comfyui.commit_datetime'] = comfy_ui_commit_datetime + + is_detached = repo.head.is_detached + current_branch = repo.active_branch.name try: if comfy_ui_commit_datetime.date() < comfy_ui_required_commit_datetime.date(): @@ -343,7 +346,10 @@ def print_comfyui_version(): else: print(f"### ComfyUI Revision: {comfy_ui_revision} on '{current_branch}' [{comfy_ui_hash[:8]}] | Released on '{comfy_ui_commit_datetime.date()}'") except: - print("### ComfyUI Revision: UNKNOWN (The currently installed ComfyUI is not a Git repository)") + if is_detached: + print(f"### ComfyUI Revision: {comfy_ui_revision} [{comfy_ui_hash[:8]}] *DETACHED | Released on '{comfy_ui_commit_datetime.date()}'") + else: + print("### ComfyUI Revision: UNKNOWN (The currently installed ComfyUI is not a Git repository)") print_comfyui_version()