1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| public SVNCommitInfo commitI18nFiles(SVNRepository repository, String path, List<OutputElement> ins, String message) throws SVNException, IOException {
latestRevision = repository.getLatestRevision();
ISVNEditor editor = repository.getCommitEditor(message, new WorkspaceMediator());
editor.openRoot(latestRevision);
editor.openDir(path, latestRevision);
// j'insère les éléments de mon fichier contenu dans ma structure "in"
try {
editor.openFile(in.getEntry().getName(), latestRevision);
editor.applyTextDelta(in.getEntry().getName(), null);
SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
ByteArrayInputStream curStream = in.getIn();
String checksum = deltaGenerator.sendDelta(in.getEntry().getName(), curStream, editor, true);
editor.closeFile(in.getEntry().getName(), checksum);
curStream.close();
} catch (Exception e) {
// TODO Add a new file
editor.addFile(in.getEntry().getName(), null, -1);
}
// Closes the directory.
editor.closeDir();
// Closes the root directory.
editor.closeDir();
return editor.closeEdit(); |
Partager