SVN KIT提交评论问题

时间:2016-08-10 20:08:49

标签: java svnkit

我正在使用SVNKIT提交SVN的更改。它在java中运行正常。问题是评论没有保存在svn中。 我正在做类似下面的事情:

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

和modifyFile方法如下所示

 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();
    }

我无法找到为什么没有保存评论的错误。相同的maven条目是 -

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

2 个答案:

答案 0 :(得分:2)

好的,感谢我的一位聪明的队友,我找到了解决方案。在1.8.11版本中似乎存在一个错误,并且它不允许保存注释。 我将pom.xml中的版本更改为1.7.5,它可以像任何东西一样工作。

代码没有变化。对于那些在同样问题上苦苦挣扎的人可能会有所帮助

答案 1 :(得分:0)

从SVNKIT 1.8.9开始,支持Subversion1.8的临时事务属性[引用https://subversion.apache.org/docs/api/1.8/group__Capabilities.html#gae1424ec62e198a77499726431c35ab6e]导致问题。因此,使用1.8.9之前的任何SVNKIT版本都不应该出现此错误。请参阅https://svn.svnkit.com/repos/svnkit/branches/1.8.x/CHANGES.txt以了解SVNKIT在多个版本上所做的更改