Skip to content

Commit d5e565c

Browse files
feat(svn): 增强SVN调试功能并改进错误处理
- 新增SVN错误处理类,提供更友好的错误提示和指导 - 改进调试命令的输出信息,包含仓库URL和工作副本路径 - 为常见SVN错误添加详细处理逻辑和用户引导 - 优化命令标题的国际化支持 - 简化提交信息解析逻辑,提高可读性
1 parent e0de69c commit d5e565c

File tree

4 files changed

+358
-177
lines changed

4 files changed

+358
-177
lines changed

src/activate/registerCommands.ts

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -230,47 +230,69 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
230230
SvnLogger.info(`Starting SVN debug for workspace: ${workspaceRoot}`)
231231

232232
try {
233-
// check svn installed
233+
// Check SVN installation and repository status
234+
// Note: These functions now handle their own user-friendly error messages
234235
SvnLogger.info("Checking if SVN is installed...")
235236
const svnInstalled = await checkSvnInstalled()
236237
SvnLogger.info(`SVN installed: ${svnInstalled}`)
237238

238239
if (!svnInstalled) {
239-
vscode.window.showErrorMessage("SVN is not installed or not in PATH")
240+
// Error message already shown by checkSvnInstalled
240241
return
241242
}
242243

243-
// check svn repo
244244
SvnLogger.info("Checking if current directory is an SVN repository...")
245245
const isSvnRepo = await checkSvnRepo(workspaceRoot)
246246
SvnLogger.info(`Is SVN repository: ${isSvnRepo}`)
247247

248248
if (!isSvnRepo) {
249-
vscode.window.showWarningMessage("Current workspace is not an SVN repository")
249+
// Error message already shown by checkSvnRepo
250250
return
251251
}
252252

253-
// get svn repo info
253+
// Get SVN repository information
254254
SvnLogger.info("Getting SVN repository information...")
255255
const repoInfo = await getSvnRepositoryInfo(workspaceRoot)
256256
SvnLogger.info(`Repository info: ${JSON.stringify(repoInfo, null, 2)}`)
257257

258-
// search recent commits
258+
// Search for recent commits
259259
SvnLogger.info("Searching for recent commits...")
260260
const commits = await searchSvnCommits("", workspaceRoot)
261261
SvnLogger.info(`Found ${commits.length} commits`)
262+
262263
commits.forEach((commit, index) => {
263264
SvnLogger.info(`Commit ${index + 1}: r${commit.revision} - ${commit.message}`)
264265
})
265266

266-
vscode.window.showInformationMessage(
267-
`SVN Debug Complete! Found ${commits.length} commits. Check "Roo Code - SVN Debug" output channel for details.`,
267+
// Show success message
268+
const action = await vscode.window.showInformationMessage(
269+
`SVN Debug Complete! Found ${commits.length} commits.\n\nRepository URL: ${repoInfo.repositoryUrl || "Unknown"}\nWorking Copy Root: ${repoInfo.workingCopyRoot || "Unknown"}\n\nCheck "Roo Code - SVN Debug" output channel for detailed information.`,
270+
{ modal: false },
271+
"Show Output",
268272
)
273+
274+
if (action === "Show Output") {
275+
SvnLogger.showOutput()
276+
}
269277
} catch (error) {
270-
SvnLogger.error("SVN debug failed", error)
271-
vscode.window.showErrorMessage(
272-
`SVN debug failed: ${error instanceof Error ? error.message : String(error)}`,
273-
)
278+
// This should rarely happen now since individual functions handle their own errors
279+
const svnError = error instanceof Error ? error : new Error(String(error))
280+
SvnLogger.error("SVN debug failed", svnError)
281+
282+
vscode.window
283+
.showErrorMessage(
284+
"SVN debug operation failed",
285+
{
286+
modal: false,
287+
detail: `Unexpected error: ${svnError.message}\n\nPlease check the SVN Debug output channel for more details.`,
288+
},
289+
"Show Output",
290+
)
291+
.then((action) => {
292+
if (action === "Show Output") {
293+
SvnLogger.showOutput()
294+
}
295+
})
274296
}
275297
},
276298
})

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
},
178178
{
179179
"command": "roo-cline.debugSvn",
180-
"title": "Debug SVN Integration",
180+
"title": "%command.debugSvn.title%",
181181
"category": "%configuration.title%"
182182
}
183183
],

src/package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"command.terminal.fixCommand.title": "Fix This Command",
2626
"command.terminal.explainCommand.title": "Explain This Command",
2727
"command.acceptInput.title": "Accept Input/Suggestion",
28+
"command.debugSvn.title": "Debug SVN Integration",
2829
"configuration.title": "Roo Code",
2930
"commands.allowedCommands.description": "Commands that can be auto-executed when 'Always approve execute operations' is enabled",
3031
"commands.deniedCommands.description": "Command prefixes that will be automatically denied without asking for approval. In case of conflicts with allowed commands, the longest prefix match takes precedence. Add * to deny all commands.",

0 commit comments

Comments
 (0)