public static void copyBranch ( String base , String branch , long revision , String baseUrl ) throws IOException { log . info ( "Copying branch " + base + AT_REVISION + revision + " to branch " + branch ) ; CommandLine cmdLine = new CommandLine ( SVN_CMD ) ; cmdLine . addArgument ( "cp" ) ; addDefaultArguments ( cmdLine , null , null ) ; if ( revision > 0 ) { cmdLine . addArgument ( "-r" + revision ) ; } cmdLine . addArgument ( "-m" ) ; cmdLine . addArgument ( "Branch automatically created from " + base + ( revision > 0 ? AT_REVISION + revision : "" ) ) ; cmdLine . addArgument ( baseUrl + base ) ; cmdLine . addArgument ( baseUrl + branch ) ; /* svn copy -r123 http://svn.example.com/repos/calc/trunk \ http://svn.example.com/repos/calc/branches/my-calc-branch */ try ( InputStream result = ExecutionHelper . getCommandResult ( cmdLine , new File ( "." ) , 0 , 120000 ) ) { log . info ( "Svn-Copy reported:\n" + extractResult ( result ) ) ; } }
Make a branch by calling the svn cp operation .