Skip to content

Commit 03540ba

Browse files
refactor(svn): Removing output channel function simplifies log processing
Removes the code related to the VS Code output channel, simplifies the implementation of SvnLogger, and uses only console for logging. At the same time, all interactive logic related to "Show Output" is removed to simplify the display of errors and information prompts.
1 parent 63db152 commit 03540ba

File tree

3 files changed

+15
-87
lines changed

3 files changed

+15
-87
lines changed

src/activate/registerCommands.ts

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -265,34 +265,19 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
265265
})
266266

267267
// 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.`,
268+
vscode.window.showInformationMessage(
269+
`SVN Debug Complete! Found ${commits.length} commits.\n\nRepository URL: ${repoInfo.repositoryUrl || "Unknown"}\nWorking Copy Root: ${repoInfo.workingCopyRoot || "Unknown"}`,
270270
{ modal: false },
271-
"Show Output",
272271
)
273-
274-
if (action === "Show Output") {
275-
SvnLogger.showOutput()
276-
}
277272
} catch (error) {
278273
// This should rarely happen now since individual functions handle their own errors
279274
const svnError = error instanceof Error ? error : new Error(String(error))
280275
SvnLogger.error("SVN debug failed", svnError)
281276

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-
})
277+
vscode.window.showErrorMessage("SVN debug operation failed", {
278+
modal: false,
279+
detail: `Unexpected error: ${svnError.message}`,
280+
})
296281
}
297282
},
298283
})

src/utils/__tests__/svn.spec.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ vi.mock("vscode", () => ({
2222
],
2323
},
2424
window: {
25-
createOutputChannel: vi.fn(() => ({
26-
appendLine: vi.fn(),
27-
show: vi.fn(),
28-
})),
29-
showErrorMessage: vi.fn(() => Promise.resolve("Show Output")),
25+
showErrorMessage: vi.fn(() => Promise.resolve()),
3026
showWarningMessage: vi.fn(() => Promise.resolve()),
3127
showInformationMessage: vi.fn(() => Promise.resolve()),
3228
},

src/utils/svn.ts

Lines changed: 8 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -46,67 +46,24 @@ function convertSvnOutput(output: Buffer | string): string {
4646
const execAsync = promisify(exec)
4747
const SVN_OUTPUT_LINE_LIMIT = 500
4848

49-
// SVN Debug Logger
49+
// SVN Debug Logger - simplified to use console only
5050
export class SvnLogger {
51-
private static outputChannel: vscode.OutputChannel | null = null
52-
53-
static getOutputChannel(): vscode.OutputChannel {
54-
if (!this.outputChannel) {
55-
this.outputChannel = vscode.window.createOutputChannel("Roo Code - SVN Debug")
56-
}
57-
return this.outputChannel
58-
}
59-
6051
static debug(message: string, ...args: any[]) {
6152
const timestamp = new Date().toISOString()
62-
const logMessage = `[${timestamp}] [DEBUG] ${message}`
63-
64-
// Log to console
53+
const logMessage = `[${timestamp}] [SVN DEBUG] ${message}`
6554
console.log(logMessage, ...args)
66-
67-
// Log to VS Code output channel
68-
const channel = this.getOutputChannel()
69-
channel.appendLine(logMessage)
70-
if (args.length > 0) {
71-
channel.appendLine(` Args: ${JSON.stringify(args, null, 2)}`)
72-
}
7355
}
7456

7557
static error(message: string, error?: any) {
7658
const timestamp = new Date().toISOString()
77-
const logMessage = `[${timestamp}] [ERROR] ${message}`
78-
79-
// Log to console
59+
const logMessage = `[${timestamp}] [SVN ERROR] ${message}`
8060
console.error(logMessage, error)
81-
82-
// Log to VS Code output channel
83-
const channel = this.getOutputChannel()
84-
channel.appendLine(logMessage)
85-
if (error) {
86-
channel.appendLine(` Error: ${error.toString()}`)
87-
if (error.stack) {
88-
channel.appendLine(` Stack: ${error.stack}`)
89-
}
90-
}
9161
}
9262

9363
static info(message: string, ...args: any[]) {
9464
const timestamp = new Date().toISOString()
95-
const logMessage = `[${timestamp}] [INFO] ${message}`
96-
97-
// Log to console
65+
const logMessage = `[${timestamp}] [SVN INFO] ${message}`
9866
console.log(logMessage, ...args)
99-
100-
// Log to VS Code output channel
101-
const channel = this.getOutputChannel()
102-
channel.appendLine(logMessage)
103-
if (args.length > 0) {
104-
channel.appendLine(` Data: ${JSON.stringify(args, null, 2)}`)
105-
}
106-
}
107-
108-
static showOutput() {
109-
this.getOutputChannel().show()
11067
}
11168
}
11269

@@ -411,20 +368,10 @@ class SvnErrorHandler {
411368
}
412369

413370
// Generic error with context
414-
vscode.window
415-
.showErrorMessage(
416-
`SVN ${context} failed`,
417-
{
418-
modal: false,
419-
detail: `Error: ${error.message}\n\nPlease check the SVN Debug output channel for more details.`,
420-
},
421-
"Show Output",
422-
)
423-
.then((action) => {
424-
if (action === "Show Output") {
425-
SvnLogger.showOutput()
426-
}
427-
})
371+
vscode.window.showErrorMessage(`SVN ${context} failed`, {
372+
modal: false,
373+
detail: `Error: ${error.message}`,
374+
})
428375
}
429376
}
430377

0 commit comments

Comments
 (0)