commit.textDeltaEnd(); commit.closeFile(null);
commit.textDeltaEnd(fileName); commit.closeFile(fileName, null);
    private void doUpdate(SVNRepository repository, boolean delete, String fileName) throws Throwable {        File dst = AllTests.createPlayground();        File dst2 = AllTests.createPlayground();                AllTests.runSVNCommand("co", new String[] {repository.getLocation().toString(), dst2.getAbsolutePath()});        final ISVNDirectoryEntry root = createDirEntry(dst.getAbsolutePath(), repository.getLocation().toString());        ISVNWorkspaceMediator mediator = new SVNCommitMediator(root);        ISVNEditor editor = new SVNCheckoutEditor2(mediator, root);        // do checkout.        repository.checkout(-2, null, true, editor);                    assertEquals(dst2, dst);                ISVNEditor commit = repository.getCommitEditor("test commit", mediator);        commit.openRoot(1);        // add file                    commit.addDir("newDirectory", null, -1);        commit.addFile("newDirectory/newFile.txt", null, -1);        commit.applyTextDelta(null);        SVNDiffWindow window = SVNDiffWindowBuilder.createReplacementDiffWindow(4);        OutputStream os = commit.textDeltaChunk(window);        os.write("file".getBytes());        os.close();        commit.textDeltaEnd();        commit.closeFile(null);        commit.closeDir();        // change file        commit.openFile(fileName, 1);        commit.applyTextDelta(null);        window = SVNDiffWindowBuilder.createReplacementDiffWindow(8);        os = commit.textDeltaChunk(window);        os.write("modified".getBytes());        os.close();        commit.textDeltaEnd();        commit.closeFile(null);        // delete only for root repository!        if (delete) {            commit.deleteEntry("directory", 1);        }                             commit.closeDir(); // ROOT        commit.closeEdit();        // do update        ISVNEntry root2 = createDirEntry(dst.getAbsolutePath(), repository.getLocation().toString());        editor = new SVNCheckoutEditor2(mediator, root2);        ISVNReporterBaton reportBaton = new SVNFSReporterBaton(root2);        AllTests.runSVNCommand("up", new String[] {dst2.getAbsolutePath()});        repository.update(-2, null, true, reportBaton, editor);                    assertEquals(dst2, dst);    }