From bfdcbe4f0a5603ea6575fe90e0c2134e52e74f7e Mon Sep 17 00:00:00 2001 From: Tim Sinaeve Date: Tue, 28 Oct 2025 19:00:06 +0100 Subject: [PATCH] Add SVN switch task step support --- components/modals/RepoFormModal.tsx | 19 +++++++++++++++---- electron/main.ts | 3 +++ hooks/useRepositoryManager.ts | 10 ++++++++++ types.ts | 3 ++- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/components/modals/RepoFormModal.tsx b/components/modals/RepoFormModal.tsx index 9a598cb..9545779 100644 --- a/components/modals/RepoFormModal.tsx +++ b/components/modals/RepoFormModal.tsx @@ -78,6 +78,7 @@ const STEP_DEFINITIONS: Record onRemoveStep(step.id)} className="p-1.5 text-red-500 hover:bg-red-100 dark:hover:bg-red-900/50 rounded-full"> - {step.type === TaskStepType.GitCheckout && ( + {(step.type === TaskStepType.GitCheckout || step.type === TaskStepType.SvnSwitch) && (
- - onStepChange(step.id, { branch: e.target.value })} required className={formInputStyle} /> + + onStepChange(step.id, { branch: e.target.value })} + required + className={formInputStyle} + />
)} {step.type === TaskStepType.DelphiBuild && ( @@ -1339,6 +1349,7 @@ const TaskStepsEditor: React.FC<{ const newStep: TaskStep = { id: `step_${Date.now()}`, type, enabled: true }; if (type === TaskStepType.RunCommand) newStep.command = suggestions.length > 0 ? suggestions[0].value : 'npm run build'; if (type === TaskStepType.GitCheckout) newStep.branch = 'main'; + if (type === TaskStepType.SvnSwitch) newStep.branch = 'trunk'; setTask({ ...task, steps: [...task.steps, newStep] }); setIsAddingStep(false); }; diff --git a/electron/main.ts b/electron/main.ts index 3927403..19ebac3 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -2197,6 +2197,9 @@ ipcMain.on('run-task-step', async (event, { repo, step, settings, executionId, t case TaskStepType.GitStash: await run(`${gitCmd} stash`); break; // SVN Steps case TaskStepType.SvnUpdate: await run(`${svnCmd} update`); break; + case TaskStepType.SvnSwitch: + if (!step.branch) { sendLog('Skipping SVN switch: no target specified.', LogLevel.Warn); sendEnd(0); return; } + await run(`${svnCmd} switch ${step.branch}`); break; // Common Steps case TaskStepType.RunCommand: if (!step.command) { sendLog('Skipping empty command.', LogLevel.Warn); sendEnd(0); return; } diff --git a/hooks/useRepositoryManager.ts b/hooks/useRepositoryManager.ts index f4251ff..2bf436f 100644 --- a/hooks/useRepositoryManager.ts +++ b/hooks/useRepositoryManager.ts @@ -280,6 +280,16 @@ const runSimulationStep = async ( randomFail(0.1, 'Simulated SVN conflict.'); addLogEntry(repoId, 'Successfully updated working copy.', LogLevel.Success); break; + case TaskStepType.SvnSwitch: + if (!step.branch) { + addLogEntry(repoId, 'Skipping SVN switch: no target specified.', LogLevel.Warn); + break; + } + addLogEntry(repoId, `svn switch ${step.branch}`, LogLevel.Command); + await simulateDelay(1200); + randomFail(0.1, 'Simulated SVN switch failure.'); + addLogEntry(repoId, `Switched working copy to '${step.branch}'.`, LogLevel.Success); + break; case TaskStepType.GitFetch: addLogEntry(repoId, `git fetch`, LogLevel.Command); await simulateDelay(1000); diff --git a/types.ts b/types.ts index a18d3fe..5a7cde7 100644 --- a/types.ts +++ b/types.ts @@ -80,6 +80,7 @@ export enum TaskStepType { GitCheckout = 'GIT_CHECKOUT', GitStash = 'GIT_STASH', SvnUpdate = 'SVN_UPDATE', + SvnSwitch = 'SVN_SWITCH', RunCommand = 'RUN_COMMAND', // Delphi DelphiBuild = 'DELPHI_BUILD', @@ -195,7 +196,7 @@ export interface TaskStep { id: string; type: TaskStepType; enabled: boolean; - branch?: string; // for GitCheckout + branch?: string; // for GitCheckout / SvnSwitch target command?: string; // for RunCommand // Delphi delphiProjectFile?: string;