mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-15 01:27:05 +08:00
fix(git): handle divergent branches safely during pull
- Use --ff-only flag to detect non-fast-forward situations - Create backup branch before resetting divergent local branch - Reset to remote branch when fast-forward is not possible - Use time.strftime() instead of datetime for better compatibility - Bump version to 3.38.2
This commit is contained in:
parent
d3a4a7a0fa
commit
891005bcd3
@ -2,6 +2,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
import time
|
||||||
|
|
||||||
import git
|
import git
|
||||||
import json
|
import json
|
||||||
@ -219,7 +220,14 @@ def gitpull(path):
|
|||||||
repo.close()
|
repo.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
remote.pull()
|
try:
|
||||||
|
repo.git.pull('--ff-only')
|
||||||
|
except git.GitCommandError:
|
||||||
|
backup_name = f'backup_{time.strftime("%Y%m%d_%H%M%S")}'
|
||||||
|
repo.create_head(backup_name)
|
||||||
|
print(f"[ComfyUI-Manager] Cannot fast-forward. Backup created: {backup_name}")
|
||||||
|
repo.git.reset('--hard', f'{remote_name}/{branch_name}')
|
||||||
|
print(f"[ComfyUI-Manager] Reset to {remote_name}/{branch_name}")
|
||||||
|
|
||||||
repo.git.submodule('update', '--init', '--recursive')
|
repo.git.submodule('update', '--init', '--recursive')
|
||||||
new_commit_hash = repo.head.commit.hexsha
|
new_commit_hash = repo.head.commit.hexsha
|
||||||
|
|||||||
@ -44,7 +44,7 @@ import manager_migration
|
|||||||
from node_package import InstalledNodePackage
|
from node_package import InstalledNodePackage
|
||||||
|
|
||||||
|
|
||||||
version_code = [3, 38, 1]
|
version_code = [3, 38, 2]
|
||||||
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
|
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
|
||||||
|
|
||||||
|
|
||||||
@ -2253,9 +2253,17 @@ def git_pull(path):
|
|||||||
|
|
||||||
current_branch = repo.active_branch
|
current_branch = repo.active_branch
|
||||||
remote_name = current_branch.tracking_branch().remote_name
|
remote_name = current_branch.tracking_branch().remote_name
|
||||||
remote = repo.remote(name=remote_name)
|
|
||||||
|
|
||||||
remote.pull()
|
try:
|
||||||
|
repo.git.pull('--ff-only')
|
||||||
|
except git.GitCommandError:
|
||||||
|
branch_name = current_branch.name
|
||||||
|
backup_name = f'backup_{time.strftime("%Y%m%d_%H%M%S")}'
|
||||||
|
repo.create_head(backup_name)
|
||||||
|
logging.info(f"[ComfyUI-Manager] Cannot fast-forward. Backup created: {backup_name}")
|
||||||
|
repo.git.reset('--hard', f'{remote_name}/{branch_name}')
|
||||||
|
logging.info(f"[ComfyUI-Manager] Reset to {remote_name}/{branch_name}")
|
||||||
|
|
||||||
repo.git.submodule('update', '--init', '--recursive')
|
repo.git.submodule('update', '--init', '--recursive')
|
||||||
|
|
||||||
repo.close()
|
repo.close()
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "comfyui-manager"
|
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."
|
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
|
||||||
version = "3.38.1"
|
version = "3.38.2"
|
||||||
license = { file = "LICENSE.txt" }
|
license = { file = "LICENSE.txt" }
|
||||||
dependencies = ["GitPython", "PyGithub", "matrix-nio", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions", "toml", "uv", "chardet"]
|
dependencies = ["GitPython", "PyGithub", "matrix-nio", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions", "toml", "uv", "chardet"]
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user