I develop a Java program using the SVNKit library that will be responsible to update or commit a directory under version control. The directory content can be changed by another program which I don't have control, this program can add, delete or edit files ignoring to set subversion information.
Question is «How can my program know what to commit» ?
Because new files were not added I tried to process a doImport of rootDirectory but it causes an SVNException saying that file already exist at repository side.
SVNCommitClient cc = cm.getCommitClient();
cc.doImport(new File(subVersionedDirectory), SVNURL.parseURIEncoded(repositoryURL), "<import> " + commitMessage, null, false, true, SVNDepth.fromRecurse(true));
I also find a piece of code that will probably mark missing files as DELETED before commit
cc.setCommitParameters(new ISVNCommitParameters() {
// delete even those files
// that are not scheduled for deletion.
public Action onMissingFile(File file) {
return DELETE;
}
public Action onMissingDirectory(File file) {
return DELETE;
}
// delete files from disk after committing deletion.
public boolean onDirectoryDeletion(File directory) {
return true;
}
public boolean onFileDeletion(File file) {
return true;
}
});
cc.doCommit(new File[]{new File(subVersionedDirectory)}, false, "<commit> " + commitMessage, null, null, false, true, SVNDepth.INFINITY);