svn_revert
Revert local changes to files or directories in a Subversion (SVN) repository by specifying the paths to undo modifications and restore previous versions.
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 implementation in SvnService.revert(). Validates paths, constructs 'svn revert [paths]' command arguments, executes via executeSvnCommand, cleans output, and returns structured response.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-510 (registration)MCP tool registration for 'svn_revert'. Includes description, input schema validation with Zod, and thin async 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}` }], }; } } );
- index.ts:487-489 (schema)Zod input schema defining the 'paths' parameter as string or array of strings for files/directories to revert.{ paths: z.union([z.string(), z.array(z.string())]).describe("Archivo(s) o directorio(s) a revertir") },