🐛 fix(vscode): 摘修复按 Gitea PR 提交列表分组

This commit is contained in:
cruldra committed 2026-09-01 18:53:41 +08:00
1 parent c0f8da5514
commit 4d3b2a0d67
6 files changed
+193 -34

No files matched your search

+26 -1
View File
@@ -7,7 +7,11 @@
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 {
cherryPickToRelease,
cutRelease,
@@ -101,7 +105,28 @@ export async function handleReleaseCherryPick(panel: KanbanWebviewPanel): Promis
toast(panel, 'info', '没有待摘的提交')
return
}
panel.postMessage({ type: 'release/pick-show', branch: current, groups: groupCommitsByPr(commits) })
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) })
}
catch (err) {
toast(panel, 'error', err instanceof Error ? err.message : String(err), { dismissOnTimer: 10_000 })