In my svn repository, the directory hierarchy is like this:
/dirA(exists)/
/dirB(exists)/
which dirB is in dirA, and both are exist.
Now, i want to add a folder(dirC) in dirB, and a file(file1.txt) in dirC, so i wish directory hierarchy is like this:
/dirA(exists)/
/dirB(exists)/
/dirC(added)/
/file1.txt(added)
With SVNKit, my SVNRepository's instance is points to dirA, i use getCommitEditor() to get an ISVNEditor's instance, and call it's openRoot(-1) method, like this:
ISVNEditor svnEditor = svnRepository.getCommitEditor("add folder and file.", null);
svnEditor.openRoot(-1);
i call ISVNEditor's addDir() method and addFile() method to add folder and file, like this:
svnEditor.addDir("dirB/dirC", null, -1);
svnEditor.addFile("dirB/dirC/file1.txt", null, -1);
svnEditor.applyTextDelta("dirB/dirC/file1.txt", null);
SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
String checksum = deltaGenerator.sendDelta("dirB/dirC/file1.txt", new ByteArrayInputStream(data), svnEditor, true);
svnEditor.closeFile("dirB/dirC/file1.txt", checksum);//Closes the new added file.
svnEditor.closeDir(); //Closes the new added folder.
svnEditor.closeDir(); //Closes the root folder.
svnEditor.closeEdit();
After that, why the dirC is being added in dirA, not in dirB, directory hierarchy is become like this:
/dirA(root)/
/dirB(exists)/
/dirC(added)/
/file1.txt(added)
I had indicate the dirC is under dirB when I call
svnEditor.addDir("dirB/dirC", null, -1),
but it doesn't seem to work? Thanks in advance to answer my question.