Skip to content

Commit b558b32

Browse files
feat(svn): 增强SVN提交信息获取功能,添加版本号格式验证
- 在获取SVN提交信息的函数中新增版本号格式验证,确保输入的版本号为有效的数字格式 - 更新上下文菜单选项,新增对SVN类型的支持,确保用户在空查询时能够获取到完整的选项列表
1 parent f5e366f commit b558b32

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/utils/svn.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,9 @@ export async function getSvnCommitInfoForMentions(revision: string, cwd: string)
730730
}
731731

732732
const cleanRevision = revision.replace(/^r/i, "")
733+
if (!/^\d+$/.test(cleanRevision)) {
734+
throw new Error("Invalid revision number format")
735+
}
733736
console.log("[DEBUG] Clean revision:", cleanRevision)
734737

735738
const { stdout } = await execAsync(`svn log -r ${cleanRevision} -v`, { cwd })

webview-ui/src/utils/__tests__/context-mentions.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,15 @@ describe("getContextMenuOptions", () => {
196196

197197
it("should return all option types for empty query", () => {
198198
const result = getContextMenuOptions("", "", null, [])
199-
expect(result).toHaveLength(6)
199+
expect(result).toHaveLength(7)
200200
expect(result.map((item) => item.type)).toEqual([
201201
ContextMenuOptionType.Problems,
202202
ContextMenuOptionType.Terminal,
203203
ContextMenuOptionType.URL,
204204
ContextMenuOptionType.Folder,
205205
ContextMenuOptionType.File,
206206
ContextMenuOptionType.Git,
207+
ContextMenuOptionType.Svn,
207208
])
208209
})
209210

0 commit comments

Comments
 (0)