private SVNCommitInfo createSecondCommit() throws SVNException { String logMessage = "test second commit"; ISVNWorkspaceMediator mediator = new PostCommitWorkspaceMediator(); ISVNEditor editor = repository.getCommitEditor(logMessage, mediator); editor.openRoot(1); editor.addFile("dirB/file2.txt", null, -1); editor.applyTextDelta("dirB/file2.txt", null); OutputStream os = editor.textDeltaChunk("dirB/file2.txt", SVNDiffWindow.EMPTY); editor.textDeltaEnd("dirB/file2.txt"); editor.closeFile("dirB/file2.txt", null); return editor.closeEdit(); }
/** * I take no credit for the below code. The creation of the svn repository is provided by the * svnkit library guys at: http://wiki.svnkit.com/Setting_Up_A_Subversion_Repository * * @throws SVNException */ private SVNCommitInfo createSVNRepository() throws Exception { FSRepositoryFactory.setup(); String repoDir = "/tmp/399165/svn"; SVNRepositoryFactoryImpl.setup(); SVNURL repo = SVNRepositoryFactory.createLocalRepository(new File("/tmp/399165"), true, true); repository = SVNRepositoryFactory.create(repo); String logMessage = "test commit message"; ISVNWorkspaceMediator mediator = new PostCommitWorkspaceMediator(); ISVNEditor editor = repository.getCommitEditor(logMessage, mediator); editor.openRoot(-1); editor.addDir("dirB", null, -1); editor.addFile("dirB/file1.txt", null, -1); editor.applyTextDelta("dirB/file1.txt", null); OutputStream os = editor.textDeltaChunk("dirB/file1.txt", SVNDiffWindow.EMPTY); editor.textDeltaEnd("dirB/file1.txt"); editor.closeFile("dirB/file1.txt", null); return editor.closeEdit(); }