fixed: cm-cli - crash when comfyui doesn't have .git dir.

(support for desktop version)
This commit is contained in:
Dr.Lt.Data 2025-03-04 21:35:24 +09:00
parent fd32ba4035
commit 0bd1bf2605
3 changed files with 21 additions and 16 deletions

View File

@ -61,13 +61,17 @@ if os.path.exists(os.path.join(manager_util.comfyui_manager_path, "pip_blacklist
def check_comfyui_hash():
repo = git.Repo(comfy_path)
core.comfy_ui_revision = len(list(repo.iter_commits('HEAD')))
try:
repo = git.Repo(comfy_path)
core.comfy_ui_revision = len(list(repo.iter_commits('HEAD')))
core.comfy_ui_commit_datetime = repo.head.commit.committed_datetime
except:
print('[bold yellow]INFO: Frozen ComfyUI mode.[/bold yellow]')
core.comfy_ui_revision = 0
core.comfy_ui_commit_datetime = 0
cm_global.variables['comfyui.revision'] = core.comfy_ui_revision
core.comfy_ui_commit_datetime = repo.head.commit.committed_datetime
check_comfyui_hash() # This is a preparation step for manager_core
core.check_invalid_nodes()
@ -250,7 +254,7 @@ def fix_node(node_spec_str, is_all=False, cnt_msg=''):
res = unified_manager.unified_fix(node_name, version_spec, no_deps=cmd_ctx.no_deps)
if not res.result:
print(f"ERROR: f{res.msg}")
print(f"[bold red]ERROR: f{res.msg}[/bold red]")
def uninstall_node(node_spec_str: str, is_all: bool = False, cnt_msg: str = ''):
@ -1043,13 +1047,17 @@ def save_snapshot(
):
cmd_ctx.set_user_directory(user_directory)
if output is None:
print("[bold red]ERROR: missing output path[/bold red]")
raise typer.Exit(code=1)
if(not output.endswith('.json') and not output.endswith('.yaml')):
print("ERROR: output path should be either '.json' or '.yaml' file.")
print("[bold red]ERROR: output path should be either '.json' or '.yaml' file.[/bold red]")
raise typer.Exit(code=1)
dir_path = os.path.dirname(output)
if(dir_path != '' and not os.path.exists(dir_path)):
print(f"ERROR: {output} path not exists.")
print(f"[bold red]ERROR: {output} path not exists.[/bold red]")
raise typer.Exit(code=1)
path = asyncio.run(core.save_snapshot_with_postfix('snapshot', output, not full_snapshot))

View File

@ -42,7 +42,7 @@ import manager_downloader
from node_package import InstalledNodePackage
version_code = [3, 27, 9]
version_code = [3, 27, 10]
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
@ -2590,15 +2590,12 @@ async def get_current_snapshot(custom_nodes_only = False):
# Get ComfyUI hash
repo_path = comfy_path
if not os.path.exists(os.path.join(repo_path, '.git')):
print("ComfyUI update fail: The installed ComfyUI does not have a Git repository.")
return {}
comfyui_commit_hash = None
if not custom_nodes_only:
repo = git.Repo(repo_path)
comfyui_commit_hash = repo.head.commit.hexsha
if os.path.exists(os.path.join(repo_path, '.git')):
repo = git.Repo(repo_path)
comfyui_commit_hash = repo.head.commit.hexsha
git_custom_nodes = {}
cnr_custom_nodes = {}
file_custom_nodes = []

View File

@ -1,7 +1,7 @@
[project]
name = "comfyui-manager"
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
version = "3.27.9"
version = "3.27.10"
license = { file = "LICENSE.txt" }
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions", "toml", "uv", "chardet"]