簡體   English   中英

SVN KIT提交評論問題

[英]SVN KIT commit comments issue

我正在使用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>

好的,多虧了我一位聰明的隊友,我找到了解決方案。 在1.8.11版本中似乎存在一個錯誤,並且不允許保存注釋。 我將pom.xml中的版本更改為1.7.5,它像任何東西一樣工作。

代碼未做任何更改。 可能對同樣遇到困難的其他人有所幫助

從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在多個版本中所做的更改

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM