mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-08-07 06:20:15 -03:00
fix(update): preserve .git on release channel switch, use git checkout tag
Previously, switching to the release channel would delete .git/ and fall back to a ZIP download. This broke update.bat, manual git commands, and CM git-based update detection. Now the release path uses git checkout <latest-tag> when .git exists, and only falls back to ZIP when .git is absent (CM CNR installs). .git is never deleted - the ZIP→nightly path remains a one-way upgrade via _init_git_repo. Also updates locale strings (en, zh-CN, zh-TW, ja) to remove the now-inaccurate "remove the Git repository" wording.
This commit is contained in:
@@ -1782,7 +1782,7 @@
|
|||||||
"nightlyTitle": "Switch to Nightly Channel",
|
"nightlyTitle": "Switch to Nightly Channel",
|
||||||
"nightlyMessage": "Switching to Nightly will initialize a Git repository and track the latest main branch commits. Updates will be more frequent but may be unstable. You can switch back to Release at any time.",
|
"nightlyMessage": "Switching to Nightly will initialize a Git repository and track the latest main branch commits. Updates will be more frequent but may be unstable. You can switch back to Release at any time.",
|
||||||
"releaseTitle": "Switch to Release Channel",
|
"releaseTitle": "Switch to Release Channel",
|
||||||
"releaseMessage": "Switching to Release will remove the Git repository and install the latest stable release. Future updates will use stable releases only.",
|
"releaseMessage": "Switching to Release will checkout the latest stable release tag. Your Git repository and settings are preserved. You can switch back to Nightly at any time.",
|
||||||
"switching": "Switching to {channel} channel...",
|
"switching": "Switching to {channel} channel...",
|
||||||
"completed": "Successfully switched to {channel} channel",
|
"completed": "Successfully switched to {channel} channel",
|
||||||
"failed": "Failed to switch channel"
|
"failed": "Failed to switch channel"
|
||||||
|
|||||||
@@ -1782,7 +1782,7 @@
|
|||||||
"nightlyTitle": "ナイトリーチャンネルに切り替え",
|
"nightlyTitle": "ナイトリーチャンネルに切り替え",
|
||||||
"nightlyMessage": "ナイトリーに切り替えると、Gitリポジトリが初期化され、mainブランチの最新コミットを追跡します。更新頻度は高くなりますが、不安定な場合があります。いつでもリリース版に戻せます。",
|
"nightlyMessage": "ナイトリーに切り替えると、Gitリポジトリが初期化され、mainブランチの最新コミットを追跡します。更新頻度は高くなりますが、不安定な場合があります。いつでもリリース版に戻せます。",
|
||||||
"releaseTitle": "リリースチャンネルに切り替え",
|
"releaseTitle": "リリースチャンネルに切り替え",
|
||||||
"releaseMessage": "リリースに切り替えると、Gitリポジトリが削除され、最新の安定版がインストールされます。以降の更新は安定版のみが使用されます。",
|
"releaseMessage": "リリースに切り替えると、最新の安定版タグにチェックアウトされます。Gitリポジトリと設定は保持されます。いつでもNightlyに戻せます。",
|
||||||
"switching": "{channel} チャンネルに切り替え中...",
|
"switching": "{channel} チャンネルに切り替え中...",
|
||||||
"completed": "{channel} チャンネルに切り替えました",
|
"completed": "{channel} チャンネルに切り替えました",
|
||||||
"failed": "チャンネルの切り替えに失敗しました"
|
"failed": "チャンネルの切り替えに失敗しました"
|
||||||
|
|||||||
@@ -1782,7 +1782,7 @@
|
|||||||
"nightlyTitle": "切换到 Nightly",
|
"nightlyTitle": "切换到 Nightly",
|
||||||
"nightlyMessage": "切换到 Nightly 将初始化 Git 仓库并跟踪 main 分支的最新提交。更新更频繁但可能不稳定,可随时切回稳定版。",
|
"nightlyMessage": "切换到 Nightly 将初始化 Git 仓库并跟踪 main 分支的最新提交。更新更频繁但可能不稳定,可随时切回稳定版。",
|
||||||
"releaseTitle": "切换到稳定版",
|
"releaseTitle": "切换到稳定版",
|
||||||
"releaseMessage": "切换到稳定版将移除 Git 仓库并安装最新的稳定发布版本,后续仅使用稳定版更新。",
|
"releaseMessage": "切换到稳定版将检出最新的发布标签。Git 仓库和您的设置均会保留。可随时切换回每日构建版。",
|
||||||
"switching": "正在切换到 {channel} 频道...",
|
"switching": "正在切换到 {channel} 频道...",
|
||||||
"completed": "已切换到 {channel} 频道",
|
"completed": "已切换到 {channel} 频道",
|
||||||
"failed": "切换频道失败"
|
"failed": "切换频道失败"
|
||||||
|
|||||||
@@ -1782,7 +1782,7 @@
|
|||||||
"nightlyTitle": "切换到 Nightly",
|
"nightlyTitle": "切换到 Nightly",
|
||||||
"nightlyMessage": "切换到 Nightly 将初始化 Git 仓库并跟踪 main 分支的最新提交。更新更频繁但可能不稳定,可随时切回稳定版。",
|
"nightlyMessage": "切换到 Nightly 将初始化 Git 仓库并跟踪 main 分支的最新提交。更新更频繁但可能不稳定,可随时切回稳定版。",
|
||||||
"releaseTitle": "切换到稳定版",
|
"releaseTitle": "切换到稳定版",
|
||||||
"releaseMessage": "切换到稳定版将移除 Git 仓库并安装最新的稳定发布版本,后续仅使用稳定版更新。",
|
"releaseMessage": "切換到穩定版將檢出最新的發布標籤。Git 倉庫和您的設定均會保留。可隨時切換回每日構建版。",
|
||||||
"switching": "正在切換到 {channel} 頻道...",
|
"switching": "正在切換到 {channel} 頻道...",
|
||||||
"completed": "已切換到 {channel} 頻道",
|
"completed": "已切換到 {channel} 頻道",
|
||||||
"failed": "切換頻道失敗"
|
"failed": "切換頻道失敗"
|
||||||
|
|||||||
@@ -292,8 +292,10 @@ class UpdateRoutes:
|
|||||||
"""
|
"""
|
||||||
Switch between release and nightly update channels.
|
Switch between release and nightly update channels.
|
||||||
|
|
||||||
Release → Nightly: Initialize a Git repository (from ZIP/CM stable mode)
|
ZIP/CNR install → Nightly: git init + checkout main (one-way upgrade)
|
||||||
Nightly → Release: Remove .git, download latest release ZIP, write .tracking
|
Git install → Release: git checkout latest tag (.git preserved)
|
||||||
|
ZIP/CNR install → Release: ZIP download (no .git, stays in ZIP mode)
|
||||||
|
Git install → Nightly: git checkout main + pull
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
body = await request.json() if request.has_body else {}
|
body = await request.json() if request.has_body else {}
|
||||||
@@ -336,21 +338,17 @@ class UpdateRoutes:
|
|||||||
finally:
|
finally:
|
||||||
UpdateRoutes._restore_git(git_backup, git_folder, success, 'nightly')
|
UpdateRoutes._restore_git(git_backup, git_folder, success, 'nightly')
|
||||||
else:
|
else:
|
||||||
git_backup = None
|
|
||||||
if os.path.exists(git_folder):
|
|
||||||
git_backup = UpdateRoutes._backup_git(git_folder, 'release')
|
|
||||||
|
|
||||||
success = False
|
success = False
|
||||||
new_version = ''
|
new_version = ''
|
||||||
try:
|
|
||||||
if os.path.exists(git_folder):
|
if os.path.exists(git_folder):
|
||||||
shutil.rmtree(git_folder)
|
success, new_version = await UpdateRoutes._perform_git_update(
|
||||||
|
plugin_root, nightly=False
|
||||||
|
)
|
||||||
|
else:
|
||||||
tracking_file = os.path.join(plugin_root, '.tracking')
|
tracking_file = os.path.join(plugin_root, '.tracking')
|
||||||
if os.path.exists(tracking_file):
|
if os.path.exists(tracking_file):
|
||||||
os.remove(tracking_file)
|
os.remove(tracking_file)
|
||||||
success, new_version = await UpdateRoutes._download_and_replace_zip(plugin_root)
|
success, new_version = await UpdateRoutes._download_and_replace_zip(plugin_root)
|
||||||
finally:
|
|
||||||
UpdateRoutes._restore_git(git_backup, git_folder, success, 'release')
|
|
||||||
finally:
|
finally:
|
||||||
_restore_preserved_items(plugin_root, staged_backup_dir, staged_items)
|
_restore_preserved_items(plugin_root, staged_backup_dir, staged_items)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user