svn - svnkit: get uploaded file content during pre-commit hook -
i writing pre-commit hook in java. pre-commit hook (batch file) calls java program parameters: repositorylocation, transactionid. need validate xml files during commit , if of them seems invalid, returning non-zero exit code pre-commit hook, , entire commit transaction rolled back.
i can access contents code here of revision of file following way:
svnrepository repository = ...; svnproperties fileproperties = new svnproperties(); bytearrayoutputstream baos = new bytearrayoutputstream( ); repository.getfile( changeentry.getcopyfrompath() , revisionnum , fileproperties , baos ); log.debug("<![cdata["+baos.tostring()+"]]>"); but unable access content of file being uploaded (content of working copy, committed user). not want write svn, need read uploaded file(s)'s content , validation. commit or rollback done svn after java program finishes.
can me problem?
inside bat-file of hook can use svnlook changed ... on order list of files in transaction , filenames changed command - svnlook cat ... filename in order content of file in stdout
Comments
Post a Comment