I want to commit a modified single file. According to http://wiki.svnkit.com/Committing_To_A_Repository I use the following code:
public static SVNCommitInfo modifyFile(ISVNEditor editor, String dirPath, String filePath, InputStream is, long size) throws SVNException {
try {
SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
editor.openRoot(-1);
editor.openDir(dirPath, -1);
editor.openFile(filePath, -1);
editor.applyTextDelta(filePath, null);
String chksm = deltaGenerator.sendDelta(filePath, is, editor, true);
editor.textDeltaEnd(filePath);
editor.closeFile(filePath, chksm);
/*
* Closes the directory.
*/
editor.closeDir();
/*
* Closes the root directory.
*/
editor.closeDir();
return editor.closeEdit();
} catch (SVNException e) {
if (editor != null) {
try {
editor.abortEdit();
} catch (Exception ex) {
}
}
throw e;
}
}
But unfortunatly I get an exception despite the the commit is done by the user who owns the look:
org.tmatesoft.svn.core.SVNException: svn: E175002: PUT of '/spielwiese/!svn/wrk/e9019037-4201-0010-b534-277444c0b279/postcommittesten.txt': 423 Locked (http://localhost:8081)
svn: E175002: PUT request failed on '/spielwiese/!svn/wrk/e9019037-4201-0010-b534-277444c0b279/postcommittesten.txt'
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:106)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:90)
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:739)
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:369)
at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.performHttpRequest(DAVConnection.java:728)
at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.doPutDiff(DAVConnection.java:514)
at org.tmatesoft.svn.core.internal.io.dav.DAVCommitEditor.closeFile(DAVCommitEditor.java:335)
What do I wrong? Whats the correct way?
I tried to use the SVNCommitClient. But the SVNCommitClient needs a lokal working copy to commit single files and I don't want to create a lokal working copy. So i want to directly commit the file into the Repository at a given location.
How do I commit a file, that is locked by the current user?