🐛 fix(vscode): 发布按钮状态检查不再跑全量文件比对
This commit is contained in:
1 parent
0214ca1ab5
commit
b5b2bda353
4 files changed
+15
-8
No files matched your search
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"publisher": "clurdra",
|
"publisher": "clurdra",
|
||||||
"name": "superpowers-vscode-clurdra",
|
"name": "superpowers-vscode-clurdra",
|
||||||
"displayName": "Superpowers-clurdra",
|
"displayName": "Superpowers-clurdra",
|
||||||
"version": "0.2.113",
|
"version": "0.2.114",
|
||||||
"packageManager": "pnpm@10.27.0",
|
"packageManager": "pnpm@10.27.0",
|
||||||
"description": "Superpowers specs and plans Kanban explorer",
|
"description": "Superpowers specs and plans Kanban explorer",
|
||||||
"author": "clurdra",
|
"author": "clurdra",
|
||||||
|
|||||||
@@ -154,8 +154,12 @@ export async function getReleaseStatus(o: { cwd: string, devBranch: string, pref
|
|||||||
const current = pickCurrentRelease(o.prefix, await remoteBranchNames(o.cwd, o.prefix))
|
const current = pickCurrentRelease(o.prefix, await remoteBranchNames(o.cwd, o.prefix))
|
||||||
if (!current)
|
if (!current)
|
||||||
return base
|
return base
|
||||||
const commits = await listUnreleasedCommits({ cwd: o.cwd, devBranch: o.devBranch, current })
|
const count = await mustGit(
|
||||||
return { devBranch: o.devBranch, current, unreleased: commits.length }
|
o.cwd,
|
||||||
|
['rev-list', '--count', '--right-only', '--cherry-pick', '--no-merges', unreleasedRange(current, o.devBranch)],
|
||||||
|
'统计未发布提交失败',
|
||||||
|
)
|
||||||
|
return { devBranch: o.devBranch, current, unreleased: Number(count) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新→旧;不 fetch,调用方自己决定何时刷新远端 */
|
/** 新→旧;不 fetch,调用方自己决定何时刷新远端 */
|
||||||
|
|||||||
@@ -31,15 +31,20 @@ export async function handleReleaseStatus(panel: KanbanWebviewPanel): Promise<vo
|
|||||||
devBranch: s.devBranch,
|
devBranch: s.devBranch,
|
||||||
nextBranch: todayReleaseBranch(s.releaseBranchPrefix),
|
nextBranch: todayReleaseBranch(s.releaseBranchPrefix),
|
||||||
running: panel.releaseRunning,
|
running: panel.releaseRunning,
|
||||||
// webview 只在设置弹窗打开时才有设置快照,「部署」菜单项是否显示由这里告诉它
|
|
||||||
jenkinsConfigured: s.jenkinsJob.length > 0,
|
jenkinsConfigured: s.jenkinsJob.length > 0,
|
||||||
}
|
}
|
||||||
if (!root) {
|
if (!root) {
|
||||||
panel.postMessage({ ...base, unreleased: 0, unavailable: '请先打开一个工作区文件夹' })
|
panel.postMessage({ ...base, unreleased: 0, unavailable: '请先打开一个工作区文件夹' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const st = await getReleaseStatus({ cwd: root, devBranch: s.devBranch, prefix: s.releaseBranchPrefix })
|
try {
|
||||||
panel.postMessage({ ...base, current: st.current, unreleased: st.unreleased, unavailable: st.unavailable })
|
const st = await getReleaseStatus({ cwd: root, devBranch: s.devBranch, prefix: s.releaseBranchPrefix })
|
||||||
|
panel.postMessage({ ...base, current: st.current, unreleased: st.unreleased, unavailable: st.unavailable })
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
const message = err instanceof Error ? err.message : String(err)
|
||||||
|
panel.postMessage({ ...base, unreleased: 0, unavailable: message })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function requireRoot(): string {
|
function requireRoot(): string {
|
||||||
|
|||||||
@@ -168,8 +168,6 @@ describe('集成', () => {
|
|||||||
git(fx.repo, ['fetch', 'origin'])
|
git(fx.repo, ['fetch', 'origin'])
|
||||||
const list = await listUnreleasedCommits({ cwd: fx.repo, devBranch: 'main', current: 'release/2026-08-31' })
|
const list = await listUnreleasedCommits({ cwd: fx.repo, devBranch: 'main', current: 'release/2026-08-31' })
|
||||||
expect(list.map(c => c.subject)).toEqual(['feat: other'])
|
expect(list.map(c => c.subject)).toEqual(['feat: other'])
|
||||||
const s = await getReleaseStatus({ cwd: fx.repo, devBranch: 'main', prefix: 'release/' })
|
|
||||||
expect(s.unreleased).toBe(1)
|
|
||||||
})
|
})
|
||||||
it('标题相同但改的文件不同,仍算未发布', async () => {
|
it('标题相同但改的文件不同,仍算未发布', async () => {
|
||||||
fx = await setup()
|
fx = await setup()
|
||||||
|
|||||||
Reference in new issue
Block a user