⚡ perf(vscode): 摘修复用本地合并记录分组,列表改手风琴

This commit is contained in:
cruldra committed 2026-09-01 19:03:56 +08:00
1 parent cfabee08b7
commit 5284fc1730
8 files changed
+183 -221

No files matched your search

+13 -26
View File
@@ -7,16 +7,14 @@
import type { KanbanWebviewPanel } from '../KanbanPanel'
import { window, workspace } from 'vscode'
import { getToken } from '../../auth/secrets'
import { listClosedPullsPage, listPullRequestCommitShas } from '../../gitea/api'
import { attachPulls, indexCommitsByPull } from '../../gitea/commitPulls'
import { gitFetch } from '../../git/branches'
import { detectRepo } from '../../git/remote'
import {
attachPulls,
cherryPickToRelease,
cutRelease,
getReleaseStatus,
groupCommitsByPr,
indexUnreleasedByMergePr,
listReleaseBranches,
listUnreleasedCommits,
todayReleaseBranch,
@@ -105,28 +103,17 @@ export async function handleReleaseCherryPick(panel: KanbanWebviewPanel): Promis
toast(panel, 'info', '没有待摘的提交')
return
}
let annotated = commits
const spinner = toast(panel, 'info', '正在按 PR 分组…', { spinner: true, dismissOnTimer: 0 })
try {
const remote = await detectRepo(root)
const token = remote ? await getToken(panel.context, remote.host) : undefined
if (remote && token) {
const gitea = { host: remote.host, token, owner: remote.owner, repo: remote.repo }
const index = await indexCommitsByPull(
commits.map(c => c.sha),
page => listClosedPullsPage({ ...gitea, page }),
pr => listPullRequestCommitShas({ ...gitea, index: pr }),
)
annotated = attachPulls(commits, index)
}
}
catch {
toast(panel, 'error', '按 PR 分组失败,先按未关联列出', { dismissOnTimer: 5000 })
}
finally {
dismiss(panel, spinner)
}
panel.postMessage({ type: 'release/pick-show', branch: current, groups: groupCommitsByPr(annotated) })
const index = await indexUnreleasedByMergePr({
cwd: root,
current,
devBranch: s.devBranch,
shas: commits.map(c => c.sha),
})
panel.postMessage({
type: 'release/pick-show',
branch: current,
groups: groupCommitsByPr(attachPulls(commits, index)),
})
}
catch (err) {
toast(panel, 'error', err instanceof Error ? err.message : String(err), { dismissOnTimer: 10_000 })