svn_diff
Compare file versions in SVN repositories by specifying the file path and revision numbers to analyze changes between old and new versions.
Instructions
Ver diferencias entre versiones de archivos
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| newRevision | No | Revisión nueva | |
| oldRevision | No | Revisión antigua | |
| path | No | Ruta específica |
Implementation Reference
- tools/svn-service.ts:290-326 (handler)Core handler function in SvnService that implements the svn_diff logic by building the appropriate 'svn diff' command arguments based on provided path and revisions, executing it, and returning the cleaned diff output.async getDiff( path?: string, oldRevision?: string, newRevision?: string ): Promise<SvnResponse<string>> { try { const args = ['diff']; if (oldRevision && newRevision) { args.push('--old', `${path || '.'}@${oldRevision}`); args.push('--new', `${path || '.'}@${newRevision}`); } else if (oldRevision) { args.push('--revision', oldRevision); if (path) { args.push(normalizePath(path)); } } else if (path) { if (!validatePath(path)) { throw new SvnError(`Invalid path: ${path}`); } args.push(normalizePath(path)); } const response = await executeSvnCommand(this.config, args); return { success: true, data: cleanOutput(response.data as string), command: response.command, workingDirectory: response.workingDirectory, executionTime: response.executionTime }; } catch (error: any) { throw new SvnError(`Failed to get SVN diff: ${error.message}`); } }
- index.ts:246-278 (registration)MCP server registration of the 'svn_diff' tool, including input schema definition with Zod and the wrapper handler function that invokes SvnService.getDiff and formats the response as Markdown."svn_diff", "Ver diferencias entre versiones de archivos", { path: z.string().optional().describe("Ruta específica"), oldRevision: z.string().optional().describe("Revisión antigua"), newRevision: z.string().optional().describe("Revisión nueva") }, async (args) => { try { const result = await getSvnService().getDiff(args.path, args.oldRevision, args.newRevision); const diffOutput = result.data!; if (!diffOutput || diffOutput.trim().length === 0) { return { content: [{ type: "text", text: "✅ **No hay diferencias encontradas**" }], }; } const diffText = `🔍 **Diferencias SVN**\n\n` + `**Comando:** ${result.command}\n` + `**Tiempo de Ejecución:** ${formatDuration(result.executionTime || 0)}\n\n` + `\`\`\`diff\n${diffOutput}\n\`\`\``; return { content: [{ type: "text", text: diffText }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; } } );
- index.ts:249-252 (schema)Zod input schema for the svn_diff tool parameters.path: z.string().optional().describe("Ruta específica"), oldRevision: z.string().optional().describe("Revisión antigua"), newRevision: z.string().optional().describe("Revisión nueva") },
- common/types.ts:76-98 (schema)TypeScript type definitions for structured SVN diff output (not used in current string-returning implementation).export interface SvnDiff { oldPath: string; newPath: string; oldRevision?: number; newRevision?: number; hunks: SvnDiffHunk[]; } export interface SvnDiffHunk { oldStart: number; oldCount: number; newStart: number; newCount: number; lines: SvnDiffLine[]; } export interface SvnDiffLine { type: 'context' | 'added' | 'deleted'; content: string; oldLineNumber?: number; newLineNumber?: number; }