Repository navigation
feat(git): 多仓库分支弹窗列出共同本地/远程分支,可在所有仓库检出、新建分支并回滚;合并日志高亮各仓库当前分支 - #2126
Merged
Merged
Conversation
- 分支弹窗在各仓库下方列出所有仓库都有的分支(对应 IDEA 的 Common Local/Remote Branches),由 Core git.workspaceCommonReferences 计算 - 共同分支菜单的“检出”和“从此新建分支”按 Core git.workspaceBranchPlan 依次在每个仓库执行;本地改动冲突时按仓库 ID 列出阻塞文件,选择对所有仓库生效 - 中途失败时弹出回滚对话框,回滚已切换的仓库并删除已新建的分支 - 合并多仓库日志时请求 checkedOutHeads,每个仓库当前分支的行都带当前分支底色
…ches # Conflicts: # scripts/desktop/build-desktop-core.sh
1 task done
xiaoyumuxi
marked this pull request as ready for review
November 18, 2026 03:29
26 of 29 tasks
15 of 18 tasks
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.
关联 Issue / Linked issue
git.workspaceCommonReferences、git.workspaceBranchPlan、git.graphProjection的checkedOutHeads)for-each-ref报错,与本 PR 无关)PR 类型 / Type
改动说明 / What changes
背景 / Why
Core #75 加了“多仓库共同分支”的计算,但桌面端没有调用,所以界面上看不到任何变化。IDEA 打开含多个仓库的项目时,分支弹窗在仓库列表下方有 Common Local Branches / Common Remote Branches:列出每个仓库都有的同名分支,在这里检出或新建分支会一次作用于所有仓库;中途某个仓库失败时,IDEA 会询问是否回滚已完成的仓库。另外,#2059 的多仓库混排日志只高亮第一个仓库的当前分支,其他仓库检出的分支没有当前分支底色。
本 PR 把这两件事接到界面上;“哪些分支算共同、谁是当前分支、每个仓库按什么顺序做、怎么回滚”都由 Core 决定,桌面端只负责读取、执行和呈现。
改动 / Changes
分支弹窗的共同分支(
desktop/internal/workbench/branch_common.go、branch_common_view.go、branch_view.go)git.references(每个仓库单独限时gitTimeout),交给 Coregit.workspaceCommonReferences计算。/分组和折叠与单仓库的分支节一致;搜索框同样筛选这两节。backgroundFailed("git_workspace_common_references")。git.workspaceBranchPlan要计划,按计划顺序逐个仓库执行(每步单独限时branchOperationTimeout),已在该分支的仓库被跳过。混排日志的当前分支高亮(
desktop/internal/workbench/gitlog.go、gitlog_multi.go、desktop/internal/core/gitlog.go)git.graphProjection发送checkedOutHeads: true(不再发送currentBranch),每个仓库检出分支上的提交都有当前分支底色;单仓库日志不变。Core 客户端(
desktop/internal/core/git_workspace_branches.go)GitWorkspaceCommonReferences、GitWorkspaceBranchPlan及其请求、响应类型;GraphRequest新增CheckedOutHeads。文案(
shared/i18n/,生成desktop/internal/i18n/shared.generated.go)desktop.branch.*中英词条:共同本地/远程分支、在所有仓库新建分支的说明、检出/新建在某仓库失败、成功提示、回滚对话框的标题/说明/按钮/无法回滚的仓库、回滚成功与失败、仓库名之间的分隔符。测试(
desktop/internal/workbench/branch_common_test.go、gitlog_multi_test.go、workspace_repositories_visual_test.go)TestWorkspaceBranchPopupChecksOutACommonBranchInEveryRepository:只列出两个仓库都有的分支,main显示为当前分支,检出feature后两个仓库都切过去。TestWorkspaceCommonCheckoutRollsBackAfterAPartialFailure:beta 拒绝检出后弹出回滚对话框,alpha 已切换;点“回滚”后 alpha 回到 main。TestWorkspaceCommonNewBranchIsCreatedInEveryRepository:只有 alpha 有的分支名提示已存在;新分支在两个仓库都创建;beta 拒绝时回滚会切回 main 并删除 alpha 里的新分支。TestWorkspaceCommonCheckoutListsTheBlockingChangesOfEveryRepository:冲突对话框按“仓库/文件”列出 beta 的改动,强制检出对两个仓库都生效。gitlog_multi_test.go:混排后每一行都在当前分支高亮范围内(去掉CheckedOutHeads时该断言失败,已验证)。branch-common、branch-rollback两个场景。文档和矩阵
docs/assets/workspace-repositories/:新增共同分支和回滚对话框截图,重新生成受影响的截图,README 补充说明。docs/viva-migration.md、功能矩阵git-multi-repository-references:补充共同分支、回滚和当前分支高亮。scripts/desktop/build-desktop-core.sh:PINNED_CORE_REVISION改为 Core fix:LSP 功能进一步的修复,但是部分功能仍然不够完善没有办法进行处理 #75 分支上的5c48a67(fix:LSP 功能进一步的修复,但是部分功能仍然不够完善没有办法进行处理 #75 合并 Core main6f5fbcc后的提交,包含 main 固定过的d833d6a)。fix:LSP 功能进一步的修复,但是部分功能仍然不够完善没有办法进行处理 #75 squash 合入后要换成 main 上的 commit 再合入本 PR。不在本 PR 范围内 / Out of scope
类型专属:feat
多平台对齐
pending;Windows 实机还没运行。platform-specific),理由:范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/git-multi-repository-references.json:两端补充证据文件、验证动作和说明,实现状态保持partial(共同分支上的其他操作未做),验证状态保持pending。./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh(validated 202 platform capabilities)和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD(matrix change gate passed)。.artifacts/下生成的矩阵视图。插件归属 / Plugin ownership
develop-lithe第三节的自查命令,结果为空。refusingKernel,不涉及插件。UI 验证 / UI evidence
LITHE_VISUAL_OUTPUT_DIR=… scripts/desktop/desktop-go.sh test -tags vivahead,lithevisual ./internal/workbench -run '^TestVisualWorkspaceRepositories$' -count=1 -timeout 300s;docs/assets/workspace-repositories/。共同本地分支(深色中文 / 浅色英文):三个仓库都有 develop、main、feature/login;三个仓库不在同一分支,所以没有当前分支标记。
检出 develop 时 shared 失败(测试让 shared 拒绝检出),frontend 已在 develop 被跳过,backend 已切换,弹出回滚对话框。下方控制台开头的红色
for-each-ref报错是 #2125 的既有问题:混排 backend(在 main)和 frontend(在 develop):两个仓库当前分支上的提交都有当前分支底色(改动前只有 backend 的提交有):
其余场景见 docs/assets/workspace-repositories/README.md。
统一日志系统 / Structured logging
a.performed("git.workspace.checkout" / "git.workspace.rollback");新建分支沿用现有git.branch.create;operationFailed("git_workspace_checkout" / "git_workspace_branch_create"),回滚失败用operationFailed("git_workspace_rollback");backgroundFailed("git_workspace_common_references");界面文案 / i18n
shared/i18n/补齐中英词条,运行node scripts/i18n/generate-i18n.mjs并提交生成结果,代码通过i18n.Shared/i18n.SharedFormat读取。node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,没有放宽脚本或扩大豁免名单。逻辑归属 / Logic placement
性能与内存 / Performance and memory
设置 / Settings
N/A:没有新增或修改设置。
插件契约 / Plugin contract
N/A:只用到 Core 的宿主命令(
git.*),不涉及插件契约、能力版本或宿主方法。PINNED_CORE_REVISION已升到包含这些命令的 Core commit。发行包与资源 / Bundle and resources
./scripts/desktop/verify/verify-runtime-bundle-immutability.sh(static checks passed)。无用代码与重构 / Dead code and refactoring
验证 / Verification
scripts/desktop/desktop-go.sh vet ./...与全量scripts/desktop/desktop-go.sh test ./...scripts/desktop/desktop-go.sh test -race ./internal/workbench -run 'Workspace|Branch|Nested' -count=1.agents/skills/write-stable-tests/scripts/test-stability-macos.sh --package ./internal/workbench -- --filter '<新增与改动的测试>'TestWorkspaceCommonNewBranchIsCreatedInEveryRepository2230 ms(含 2 个子测试),TestWorkspaceBranchPopupChecksOutACommonBranchInEveryRepository1320 ms,TestWorkspaceCommonCheckoutRollsBackAfterAPartialFailure1240 ms,TestWorkspaceCommonCheckoutListsTheBlockingChangesOfEveryRepository1230 ms,TestWorkspaceLogWalksSeveralRepositoriesTogether930 ms;都低于 15000 ms 上限,前四个超过 1000 ms 提示线,因为每个都要建临时仓库并逐个仓库执行 Git 写操作.agents/skills/write-stable-tests/scripts/verify-test-stability.sh --base origin/maingitlog_multi_test.go去掉CheckedOutHeads: true后重跑TestVisualWorkspaceRepositories(-tags vivahead,lithevisual)node scripts/i18n/verify-app-language-localization.mjs、node scripts/i18n/generate-i18n.mjs --check、node scripts/i18n/test-i18n.mjs./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh、verify-platform-feature-matrix-change.sh origin/main HEAD./scripts/desktop/verify/verify-runtime-bundle-immutability.shdevelop-lithe第三节插件归属自查rgbash -n scripts/desktop/build-desktop-core.shlithe-git、lithe-core的cargo test,cargo clippy(-D warnings),cargo fmt --check(已合并 Core main6f5fbcc;lithe-git 157 个、lithe-core 820 个)未能执行的检查和原因:
pending。提交前确认 / Final checks
main(9c28f9946)创建,已用 merge 合入最新main(831e21068,feat(run): 当前文件运行——构建插件按文件找入口,保存为运行配置后运行 #2123),固定版本冲突已按上面的说明解决;目标分支main。