✨ feat(vscode): 摘修复识别 alembic 迁移,接不上发布分支链的高亮禁用不可摘
按 writing-alembic-migrations 的规矩判断:迁移的前任必须已在发布分支上, 且发布分支上该前任不能已有别的后继;根迁移接不上已有链、删迁移会断链也不可摘。 列表里带迁移的提交打「迁移」角标,不可摘的高亮警告色、禁用勾选并写明原因; 确认接口再校验一遍,绕过前端也摘不进去。 Claude-Session: https://claude.ai/code/session_01QWxLb6X8Vd2G5vHnp6R7qm
This commit is contained in:
1 parent
df0660cff7
commit
028195ab2b
8 files changed
+261
-26
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import type { ReleaseCommitGroup } from './messages'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { filterCherryPickGroups, uniqueAuthors } from './cherryPickView'
|
||||
import { filterCherryPickGroups, pickableShas, uniqueAuthors } from './cherryPickView'
|
||||
|
||||
const groups: ReleaseCommitGroup[] = [
|
||||
{
|
||||
@@ -35,3 +35,14 @@ describe('uniqueAuthors', () => {
|
||||
expect(uniqueAuthors(groups)).toEqual(['cruldra', 'chehongweo'])
|
||||
})
|
||||
})
|
||||
|
||||
describe('pickableShas', () => {
|
||||
it('带不兼容迁移的提交不能勾;兼容的迁移照常', () => {
|
||||
const commits = [
|
||||
{ sha: 'a', subject: 'ok', author: 'x', date: '', body: '' },
|
||||
{ sha: 'b', subject: 'mig ok', author: 'x', date: '', body: '', migration: { files: ['alembic/versions/0002.py'] } },
|
||||
{ sha: 'c', subject: 'mig bad', author: 'x', date: '', body: '', migration: { files: ['alembic/versions/0003.py'], blocked: '上游迁移 0002 不在 release/x' } },
|
||||
]
|
||||
expect(pickableShas(commits)).toEqual(['a', 'b'])
|
||||
})
|
||||
})
|
||||
@@ -1,4 +1,9 @@
|
||||
import type { ReleaseCommitGroup } from './messages'
|
||||
import type { ReleaseCommit, ReleaseCommitGroup } from './messages'
|
||||
|
||||
/** 能勾选的提交:带不兼容迁移的不算 */
|
||||
export function pickableShas(commits: ReleaseCommit[]): string[] {
|
||||
return commits.filter(c => !c.migration?.blocked).map(c => c.sha)
|
||||
}
|
||||
|
||||
export function uniqueAuthors(groups: ReleaseCommitGroup[]): string[] {
|
||||
const out: string[] = []
|
||||
|
||||
@@ -29,6 +29,8 @@ export interface ReleaseCommit {
|
||||
author: string
|
||||
date: string
|
||||
body: string
|
||||
/** 带 alembic 迁移文件时才有;blocked 有值就不能摘 */
|
||||
migration?: { files: string[], blocked?: string }
|
||||
}
|
||||
|
||||
export interface ReleaseCommitGroup {
|
||||
|
||||
Reference in new issue
Block a user