SVNRepository repos = SVNRepositoryFactory.create(reposURL);
ISVNEditor commitEditor = repos.getCommitEditor("initializing the repository with a greek tree",
null, false, null, null);
SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
commitEditor.openRoot(SVNRepository.INVALID_REVISION);
//add /iota file
commitEditor.addFile(IOTA, null, SVNRepository.INVALID_REVISION);
commitEditor.applyTextDelta(IOTA, null);
String fileText = (String) ourGreekTreeFiles.get(IOTA);
String checksum = deltaGenerator.sendDelta(IOTA, new ByteArrayInputStream(fileText.getBytes()),
commitEditor, true);
commitEditor.closeFile(IOTA, checksum);
//add /A directory
commitEditor.addDir("A", null, SVNRepository.INVALID_REVISION);
//add /A/mu file
String muPath = "A/" + MU;
commitEditor.addFile(muPath, null, SVNRepository.INVALID_REVISION);
commitEditor.applyTextDelta(muPath, null);
fileText = (String) ourGreekTreeFiles.get(MU);
checksum = deltaGenerator.sendDelta(muPath, new ByteArrayInputStream(fileText.getBytes()), commitEditor,
true);
commitEditor.closeFile(muPath, checksum);
commitEditor.addDir("A/B", null, SVNRepository.INVALID_REVISION);
//add /A/B/lambda file
String lambdaPath = "A/B/" + LAMBDA;
commitEditor.addFile(lambdaPath, null, SVNRepository.INVALID_REVISION);
commitEditor.applyTextDelta(lambdaPath, null);
fileText = (String) ourGreekTreeFiles.get(LAMBDA);
checksum = deltaGenerator.sendDelta(lambdaPath, new ByteArrayInputStream(fileText.getBytes()), commitEditor,
true);
commitEditor.closeFile(lambdaPath, checksum);
commitEditor.addDir("A/B/E", null, SVNRepository.INVALID_REVISION);
//add /A/B/E/alpha file
String alphaPath = "A/B/E/" + ALPHA;
commitEditor.addFile(alphaPath, null, SVNRepository.INVALID_REVISION);
commitEditor.applyTextDelta(alphaPath, null);
fileText = (String) ourGreekTreeFiles.get(ALPHA);
checksum = deltaGenerator.sendDelta(alphaPath, new ByteArrayInputStream(fileText.getBytes()), commitEditor,
true);
commitEditor.closeFile(alphaPath, checksum);
//add /A/B/E/beta file
String betaPath = "A/B/E/" + BETA;
commitEditor.addFile(betaPath, null, SVNRepository.INVALID_REVISION);
commitEditor.applyTextDelta(betaPath, null);
fileText = (String) ourGreekTreeFiles.get(BETA);
checksum = deltaGenerator.sendDelta(betaPath, new ByteArrayInputStream(fileText.getBytes()), commitEditor,
true);
commitEditor.closeFile(betaPath, checksum);
//close /A/B/E
commitEditor.closeDir();
//add /A/B/F
commitEditor.addDir("A/B/F", null, SVNRepository.INVALID_REVISION);
//close /A/B/F
commitEditor.closeDir();
//close /A/B
commitEditor.closeDir();
//add /A/C
commitEditor.addDir("A/C", null, SVNRepository.INVALID_REVISION);
//close /A/C
commitEditor.closeDir();
//add /A/D
commitEditor.addDir("A/D", null, SVNRepository.INVALID_REVISION);
//add /A/D/gamma file
String gammaPath = "A/D/" + GAMMA;
commitEditor.addFile(gammaPath, null, SVNRepository.INVALID_REVISION);
commitEditor.applyTextDelta(gammaPath, null);
fileText = (String) ourGreekTreeFiles.get(GAMMA);
checksum = deltaGenerator.sendDelta(gammaPath, new ByteArrayInputStream(fileText.getBytes()), commitEditor,
true);
commitEditor.closeFile(gammaPath, checksum);
//add /A/D/G
commitEditor.addDir("A/D/G", null, SVNRepository.INVALID_REVISION);
//add /A/D/G/pi file
String piPath = "A/D/G/" + PI;
commitEditor.addFile(piPath, null, SVNRepository.INVALID_REVISION);
commitEditor.applyTextDelta(piPath, null);
fileText = (String) ourGreekTreeFiles.get(PI);
checksum = deltaGenerator.sendDelta(piPath, new ByteArrayInputStream(fileText.getBytes()), commitEditor,
true);
//close /A/D/G/pi file
commitEditor.closeFile(piPath, checksum);
//add /A/D/G/rho file
String rhoPath = "A/D/G/" + RHO;
commitEditor.addFile(rhoPath, null, SVNRepository.INVALID_REVISION);
commitEditor.applyTextDelta(rhoPath, null);
fileText = (String) ourGreekTreeFiles.get(RHO);
checksum = deltaGenerator.sendDelta(rhoPath, new ByteArrayInputStream(fileText.getBytes()), commitEditor,
true);
//close /A/D/G/rho file
commitEditor.closeFile(rhoPath, checksum);
//add /A/D/G/tau file
String tauPath = "A/D/G/" + TAU;
commitEditor.addFile(tauPath, null, SVNRepository.INVALID_REVISION);
commitEditor.applyTextDelta(tauPath, null);
fileText = (String) ourGreekTreeFiles.get(TAU);
checksum = deltaGenerator.sendDelta(tauPath, new ByteArrayInputStream(fileText.getBytes()), commitEditor,
true);
//close /A/D/G/tau file
commitEditor.closeFile(tauPath, checksum);
//close /A/D/G
commitEditor.closeDir();
//add /A/D/H
commitEditor.addDir("A/D/H", null, SVNRepository.INVALID_REVISION);
//add /A/D/H/chi file
String chiPath = "A/D/H/" + CHI;
commitEditor.addFile(chiPath, null, SVNRepository.INVALID_REVISION);
commitEditor.applyTextDelta(chiPath, null);
fileText = (String) ourGreekTreeFiles.get(CHI);
checksum = deltaGenerator.sendDelta(chiPath, new ByteArrayInputStream(fileText.getBytes()), commitEditor,
true);
//close /A/D/H/chi file
commitEditor.closeFile(chiPath, checksum);
//add /A/D/H/omega file
String omegaPath = "A/D/H/" + OMEGA;
commitEditor.addFile(omegaPath, null, SVNRepository.INVALID_REVISION);
commitEditor.applyTextDelta(omegaPath, null);
fileText = (String) ourGreekTreeFiles.get(OMEGA);
checksum = deltaGenerator.sendDelta(omegaPath, new ByteArrayInputStream(fileText.getBytes()), commitEditor,
true);
//close /A/D/H/omega file
commitEditor.closeFile(omegaPath, checksum);
//add /A/D/H/psi file
String psiPath = "A/D/H/" + PSI;
commitEditor.addFile(psiPath, null, SVNRepository.INVALID_REVISION);
commitEditor.applyTextDelta(psiPath, null);
fileText = (String) ourGreekTreeFiles.get(PSI);
checksum = deltaGenerator.sendDelta(psiPath, new ByteArrayInputStream(fileText.getBytes()), commitEditor,
true);
//close /A/D/H/psi file
commitEditor.closeFile(psiPath, checksum);
//close /A/D/H