Skip to content

Update button: checkout main, pull, restart — from any branch#23

Merged
TN019 merged 2 commits into
mainfrom
update-check-branch-awareness
Jul 26, 2026
Merged

Update button: checkout main, pull, restart — from any branch#23
TN019 merged 2 commits into
mainfrom
update-check-branch-awareness

Conversation

@TN019

@TN019 TN019 commented Jul 26, 2026

Copy link
Copy Markdown
Owner

背景

设置里的"检查更新"此前只比对当前分支的上游:在开发分支上永远显示"已是最新",形同摆设(#22 合并后实际发生)。

改动与实现

  • core/update.py
    • check() 识别当前分支与远端默认分支(origin/HEAD,回退 main);不在发布分支时返回 branch/release_branch 与相对 origin/main 的落后数
    • 新增 update_to_release():更新按钮的唯一入口——在 main 上等价于原来的快进 pull;在开发分支上先 git checkout main 再 pull。安全契约不变:脏工作区一律拒绝、绝不触碰(切分支前后都检查)
  • GUI 更新对话框
    • 开发分支 + 干净:提示"更新将切换到 main 并拉取最新代码",按钮直接执行 切换 → 拉取 → 重启
    • 开发分支 + 有本地改动:明确提示先提交或 stash(新文案 gui.update_branch_dirty
    • main 上行为不变
  • i18n 新增/调整中英文案

验证

  • uv run pytest -q:155 passed / 5 skipped。新增用例:feature 分支上 update_to_release 切回 main 且拿到上游新提交;脏分支被拒绝且停留在原分支;check 正确报告 branch/release_branch/behind

TN019 added 2 commits July 26, 2026 19:50
…dates track main instead of a misleading 'up to date'.
…-forwards, and restarts; dirty checkouts are still refused untouched.
@TN019 TN019 changed the title Branch-aware update check Update button: checkout main, pull, restart — from any branch Jul 26, 2026
@TN019
TN019 merged commit a763424 into main Jul 26, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant