Update button: checkout main, pull, restart — from any branch#23
Merged
Conversation
…dates track main instead of a misleading 'up to date'.
…-forwards, and restarts; dirty checkouts are still refused untouched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
设置里的"检查更新"此前只比对当前分支的上游:在开发分支上永远显示"已是最新",形同摆设(#22 合并后实际发生)。
改动与实现
check()识别当前分支与远端默认分支(origin/HEAD,回退 main);不在发布分支时返回branch/release_branch与相对origin/main的落后数update_to_release():更新按钮的唯一入口——在 main 上等价于原来的快进 pull;在开发分支上先git checkout main再 pull。安全契约不变:脏工作区一律拒绝、绝不触碰(切分支前后都检查)gui.update_branch_dirty)验证
uv run pytest -q:155 passed / 5 skipped。新增用例:feature 分支上update_to_release切回 main 且拿到上游新提交;脏分支被拒绝且停留在原分支;check 正确报告 branch/release_branch/behind