svn_revert
Undo local changes to files in an SVN repository by reverting specified paths to their last committed state.
Instructions
Revertir cambios locales en archivos
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| paths | Yes | Archivo(s) o directorio(s) a revertir |
Implementation Reference
- tools/svn-service.ts:601-630 (handler)Core handler implementing the 'svn revert' command execution via executeSvnCommand on normalized paths.async revert(paths: string | string[]): Promise<SvnResponse<string>> { try { const pathArray = Array.isArray(paths) ? paths : [paths]; // Validar todas las rutas for (const path of pathArray) { if (!validatePath(path)) { throw new SvnError(`Invalid path: ${path}`); } } const args = ['revert']; // Añadir rutas normalizadas args.push(...pathArray.map(p => normalizePath(p))); 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 revert files: ${error.message}`); } }
- index.ts:484-509 (registration)MCP server tool registration for 'svn_revert', including input schema and wrapper handler that calls SvnService.revert and formats Markdown response.server.tool( "svn_revert", "Revertir cambios locales en archivos", { paths: z.union([z.string(), z.array(z.string())]).describe("Archivo(s) o directorio(s) a revertir") }, async (args) => { try { const result = await getSvnService().revert(args.paths); const pathsArray = Array.isArray(args.paths) ? args.paths : [args.paths]; const revertText = `↩️ **Cambios Revertidos**\n\n` + `**Archivos:** ${pathsArray.join(', ')}\n` + `**Comando:** ${result.command}\n` + `**Tiempo de Ejecución:** ${formatDuration(result.executionTime || 0)}\n\n` + `**Resultado:**\n\`\`\`\n${result.data}\n\`\`\``; return { content: [{ type: "text", text: revertText }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; } }