From c779573204fea03380e7546e57a25f2494985275 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Mon, 13 Jan 2025 06:22:11 +0900 Subject: [PATCH] fixed: handling cases where there is no remote branch https://github.com/ltdrdata/ComfyUI-Manager/issues/1443 --- git_helper.py | 6 +++++- glob/manager_core.py | 18 ++++++++++++++---- pyproject.toml | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/git_helper.py b/git_helper.py index 6a41f0b9..13c7fdab 100644 --- a/git_helper.py +++ b/git_helper.py @@ -195,7 +195,11 @@ def gitpull(path): branch_name = current_branch.name remote.fetch() - remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha + if f'{remote_name}/{branch_name}' in repo.refs: + remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha + else: + print("CUSTOM NODE PULL: Fail") # update fail + return if commit_hash == remote_commit_hash: print("CUSTOM NODE PULL: None") # there is no update diff --git a/glob/manager_core.py b/glob/manager_core.py index e290548d..e096289a 100644 --- a/glob/manager_core.py +++ b/glob/manager_core.py @@ -41,7 +41,7 @@ import manager_downloader from node_package import InstalledNodePackage -version_code = [3, 7] +version_code = [3, 7, 1] version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '') @@ -1264,7 +1264,10 @@ class UnifiedManager: "-----------------------------------------------------------------------------------------\n") commit_hash = repo.head.commit.hexsha - remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha + if f'{remote_name}/{branch_name}' in repo.refs: + remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha + else: + return result.fail(f"Not updatable branch: {branch_name}") if commit_hash != remote_commit_hash: git_pull(repo_path) @@ -1859,7 +1862,10 @@ def git_repo_update_check_with(path, do_fetch=False, do_update=False, no_deps=Fa current_branch = repo.active_branch branch_name = current_branch.name - remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha + if f'{remote_name}/{branch_name}' in repo.refs: + remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha + else: + return False, False if commit_hash == remote_commit_hash: repo.close() @@ -2309,7 +2315,11 @@ def update_path(repo_path, instant_execution=False, no_deps=False): return "fail" commit_hash = repo.head.commit.hexsha - remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha + + if f'{remote_name}/{branch_name}' in repo.refs: + remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha + else: + return "fail" if commit_hash != remote_commit_hash: git_pull(repo_path) diff --git a/pyproject.toml b/pyproject.toml index 408ebf3e..8ec54d5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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.7" +version = "3.7.1" license = { file = "LICENSE.txt" } dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]