svn_checkout
Check out files from an SVN repository to a local directory, specifying revision, depth, and other options for repository management.
Instructions
Hacer checkout de un repositorio SVN
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL del repositorio SVN | |
| path | No | Directorio destino | |
| revision | No | Revisión específica | |
| depth | No | Profundidad del checkout | |
| force | No | Forzar checkout | |
| ignoreExternals | No | Ignorar externals |
Implementation Reference
- tools/svn-service.ts:331-381 (handler)Core handler function that implements the SVN checkout logic by building command arguments (revision, depth, force, ignore-externals) and executing the 'svn checkout' command.async checkout( url: string, path?: string, options: SvnCheckoutOptions = {} ): Promise<SvnResponse<string>> { try { if (!validateSvnUrl(url)) { throw new SvnError(`Invalid SVN URL: ${url}`); } const args = ['checkout']; if (options.revision) { args.push('--revision', options.revision.toString()); } if (options.depth) { args.push('--depth', options.depth); } if (options.force) { args.push('--force'); } if (options.ignoreExternals) { args.push('--ignore-externals'); } args.push(url); 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 checkout: ${error.message}`); } }
- index.ts:282-319 (registration)MCP tool registration for 'svn_checkout', including input schema with Zod validation and thin wrapper handler that delegates to SvnService.checkout."svn_checkout", "Hacer checkout de un repositorio SVN", { url: z.string().describe("URL del repositorio SVN"), path: z.string().optional().describe("Directorio destino"), revision: z.union([z.number(), z.literal("HEAD")]).optional().describe("Revisión específica"), depth: z.enum(["empty", "files", "immediates", "infinity"]).optional().describe("Profundidad del checkout"), force: z.boolean().optional().default(false).describe("Forzar checkout"), ignoreExternals: z.boolean().optional().default(false).describe("Ignorar externals") }, async (args) => { try { const options = { revision: args.revision, depth: args.depth, force: args.force, ignoreExternals: args.ignoreExternals }; const result = await getSvnService().checkout(args.url, args.path, options); const checkoutText = `📥 **Checkout Completado**\n\n` + `**URL:** ${args.url}\n` + `**Destino:** ${args.path || 'Directorio actual'}\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: checkoutText }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; } } );
- common/types.ts:180-185 (schema)TypeScript interface defining the options schema for SVN checkout operation.export interface SvnCheckoutOptions { revision?: number | 'HEAD'; depth?: 'empty' | 'files' | 'immediates' | 'infinity'; force?: boolean; ignoreExternals?: boolean; }
- index.ts:292-317 (handler)MCP tool handler function that validates input, maps args to options, calls the core SvnService.checkout, formats success/error response with execution details.async (args) => { try { const options = { revision: args.revision, depth: args.depth, force: args.force, ignoreExternals: args.ignoreExternals }; const result = await getSvnService().checkout(args.url, args.path, options); const checkoutText = `📥 **Checkout Completado**\n\n` + `**URL:** ${args.url}\n` + `**Destino:** ${args.path || 'Directorio actual'}\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: checkoutText }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; }