public static long getBranchRevision ( String branch , String baseUrl ) throws IOException { CommandLine cmdLine = new CommandLine ( SVN_CMD ) ; cmdLine . addArgument ( CMD_LOG ) ; cmdLine . addArgument ( OPT_XML ) ; addDefaultArguments ( cmdLine , null , null ) ; cmdLine . addArgument ( "-v" ) ; cmdLine . addArgument ( "-r0:HEAD" ) ; cmdLine . addArgument ( "--stop-on-copy" ) ; cmdLine . addArgument ( "--limit" ) ; cmdLine . addArgument ( "1" ) ; cmdLine . addArgument ( baseUrl + branch ) ; try ( InputStream inStr = ExecutionHelper . getCommandResult ( cmdLine , new File ( "." ) , 0 , 120000 ) ) { String xml = IOUtils . toString ( inStr , "UTF-8" ) ; log . info ( "XML:\n" + xml ) ; // read the revision Matcher matcher = Pattern . compile ( "copyfrom-rev=\"([0-9]+)\"" ) . matcher ( xml ) ; if ( ! matcher . find ( ) ) { throw new IOException ( "Could not find copyfrom-rev entry in xml: " + xml ) ; } log . info ( "Found copyfrom-rev: " + matcher . group ( 1 ) ) ; return Long . parseLong ( matcher . group ( 1 ) ) ; } }
Return the revision from which the branch was branched off .