简体   繁体   中英

SVN KIT commit comments issue

I am using SVNKIT to commit changes in SVN. it is running fine as expected in java. problem is comments are not being saved in svn. i am doing something like below:

String comment = "testing here";
ISVNEditor editor = repository.getCommitEditor(comment, null /*locks*/ , false /*keepLocks*/ , null /*mediator*/ );
SVNCommitInfo commitInfo = modifyFile(editor, "", "filePath", contents, modifiedContents);

and modifyFile methos is like below

 private static SVNCommitInfo modifyFile(ISVNEditor editor, String dirPath,
            String filePath, byte[] oldData, byte[] newData) throws SVNException {

        editor.openRoot(-1);
        editor.openDir(dirPath, -1);
        editor.openFile(filePath, -1);
        editor.applyTextDelta(filePath, null);
        SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
        String checksum = deltaGenerator.sendDelta(filePath, new ByteArrayInputStream(oldData), 0, new ByteArrayInputStream(newData), editor, true);

        editor.closeFile(filePath, checksum);
        editor.closeDir();
        editor.closeDir();

        return editor.closeEdit();
    }

i am not able to find the mistake as to why comments are not being saved. maven entry for same is -

<groupId>org.tmatesoft.svnkit</groupId>
        <artifactId>svnkit</artifactId>
        <version>1.8.11</version>

ok, thanks to one of my intelligent teammate, i found the solution. there seems to be a bug in 1.8.11 version and it doesn't allow comments to be saved. i changed the version in pom.xml to 1.7.5 and it works like anything.

No change in code was done. might be helpful to others who are struggling with same issue

From SVNKIT 1.8.9 onwards there is support for ephemeral transactional properties of Subversion1.8 [Refer https://subversion.apache.org/docs/api/1.8/group__Capabilities.html#gae1424ec62e198a77499726431c35ab6e] which is causing the problem. So using any SVNKIT version prior to 1.8.9 should not give this error. Refer https://svn.svnkit.com/repos/svnkit/branches/1.8.x/CHANGES.txt to know about changes made in SVNKIT over multiple version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM