⚡ perf(vscode): 摘修复只比对发布分支多出来的提交

This commit is contained in:
cruldra committed 2026-09-01 20:07:27 +08:00
1 parent b5b2bda353
commit dd3b7aaa24
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -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.114", "version": "0.2.115",
"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",
+3 -3
View File
@@ -245,13 +245,13 @@ async function commitFileChangeKeys(cwd: string, sha: string): Promise<string[]>
} }
/** 发布分支上每个文件已有的改动指纹。用来认出「一次提交被拆成多次摘过去」的情况。 */ /** 发布分支上每个文件已有的改动指纹。用来认出「一次提交被拆成多次摘过去」的情况。 */
async function releaseFileChangeKeys(cwd: string, current: string, files: Set<string>): Promise<Set<string>> { async function releaseFileChangeKeys(cwd: string, current: string, devBranch: string, files: Set<string>): Promise<Set<string>> {
const keys = new Set<string>() const keys = new Set<string>()
if (files.size === 0) if (files.size === 0)
return keys return keys
const log = await mustGit( const log = await mustGit(
cwd, cwd,
['log', '--no-merges', '--name-only', '--format=%n%H', `origin/${current}`], ['log', '--no-merges', '--name-only', '--format=%n%H', `origin/${devBranch}..origin/${current}`],
'读取发布分支改动失败', '读取发布分支改动失败',
) )
let sha = '' let sha = ''
@@ -298,7 +298,7 @@ export async function listUnreleasedCommits(o: { cwd: string, devBranch: string,
for (const key of keys) for (const key of keys)
files.add(key.slice(0, key.indexOf('\0'))) files.add(key.slice(0, key.indexOf('\0')))
} }
const released = await releaseFileChangeKeys(o.cwd, o.current, files) const released = await releaseFileChangeKeys(o.cwd, o.current, o.devBranch, files)
return commits.filter((c) => { return commits.filter((c) => {
const keys = perCommitKeys.get(c.sha) ?? [] const keys = perCommitKeys.get(c.sha) ?? []
return keys.length === 0 || keys.some(k => !released.has(k)) return keys.length === 0 || keys.some(k => !released.has(k))