public static long getLastRevision ( String branch , String baseUrl , String user , String pwd ) throws IOException { CommandLine cmdLine = new CommandLine ( SVN_CMD ) ; cmdLine . addArgument ( "info" ) ; addDefaultArguments ( cmdLine , user , pwd ) ; cmdLine . addArgument ( baseUrl + branch ) ; try ( InputStream inStr = ExecutionHelper . getCommandResult ( cmdLine , new File ( "." ) , 0 , 120000 ) ) { String info = IOUtils . toString ( inStr , "UTF-8" ) ; log . info ( "Info:\n" + info ) ; /* svn info http://... Repository Root: https://svn-lnz.emea.cpwr.corp/svn/dev Repository UUID: 35fb04cf-4f84-b44d-92fa-8d0d0442729e Revision: 390864 Node Kind: directory */ // read the revision Matcher matcher = Pattern . compile ( "Revision: ([0-9]+)" ) . matcher ( info ) ; if ( ! matcher . find ( ) ) { throw new IOException ( "Could not find Revision entry in info-output: " + info ) ; } log . info ( "Found rev: " + matcher . group ( 1 ) + " for branch " + branch ) ; return Long . parseLong ( matcher . group ( 1 ) ) ; } }
Return the last revision of the given branch . Uses the full svn repository if branch is