Hello Jim,

To modify a file at /cs/test directory, do the following:

1. Create repository with URL http://scm.mydomain.com/repo/cs/test -
this is repository location and this will be commit editor root.
2. Call ISVNEditor like that:

editor.openRoot(-1);
editor.openFile("file.txt", -1) // file path relative to the editor root
...
editor.closeFile();
editor.closeDir();
editor.closeEdit();

In case repository location is at the repositor root, then calls will be:

editor.openRoot(-1);
editor.openDir("cs", -1);
editor.openDir("cs/test", -1);
editor.openFile("cs/test/file.txt", -1) // file path relative to the editor root
...
editor.closeFile();
editor.closeDir(); // cs/test
editor.closeDir(); // cs
editor.closeDir(); // root
editor.closeEdit();

Note, that each directory in the path should be opened and closed
individually in descending order.

Alexander Kitaev,
TMate Software,
http://subgit.com/ - Svn to Git Migration!
http://svnkit.com/ - Java [Sub]Versioning Library!
http://hg4j.com/ - Java Mercurial Library!
http://sqljet.com/ - Java SQLite Library!


On 3 May 2013 17:59, Kempton, Jim <jim.kemp...@teradata.com> wrote:
> Hi all,
>
>
>
> I’m just getting started using SVNKit (v. 1.7.9) and have a question I hope
> someone will be able to answer.
>
>
>
> I’ve been able to read files from the repository without any trouble, but
> I’m unable to write to it apparently because my login does not have write
> permission to the repository root -- even though I’m not writing to the
> root.
>
>
>
> So.  I create the repository object something like this:
>
>
>
>     String svnUrl = “http://scm.mydomain.com/repo”;
>
>     SVNRepository repository = SVNRepositoryFactory.create(
> SVNURL.parseURIEncoded( svnUrl ) );
>
>     ISVNAuthenticationManager authManager = new
> BasicAuthenticationManager(username, password);
>
>     repository.setAuthenticationManager( authManager );
>
>
>
>
>
> Then I try to commit a file something like this:
>
>
>
>    String scmPath = “/cs/test”;
>
>    String filePath = “/cs/text/mytestfile.txt”;
>
>
>
>     ISVNEditor svnEditor = repository.getCommitEditor(logMessage, null);
>
>     svnEditor.openRoot(-1);
>
>     svnEditor.openDir(scmPath, -1);
>
>
>
>     svnEditor.openFile(filePath, -1);
>
>
>
>     svnEditor.applyTextDelta(filePath, null);
>
>
>
>     final SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
>
>     final String checksum = deltaGenerator.sendDelta(filePath, new
> ByteArrayInputStream(propertiesBytes), svnEditor, true);
>
>
>
>     svnEditor.closeFile(filePath, checksum);
>
>
>
>     svnEditor.closeDir();
>
>     svnEditor.closeDir();
>
>
>
>     svnEditor.closeEdit();
>
>
>
>
>
>
>
> I get an authentication exception as soon as I do the svnEditor.openFIle()
> call.  I DO have write permission to the entire /cs tree, but not to the
> repository root.  I also get an exception if I try to simply skip calling
> svnEditor.openRoot().
>
>
>
> I asked the Subversion administrator to grant me write permission to the
> repository root temporarily, and the code worked beautifully.
>
>
>
> So, is there any way we can preserve the permissions and still allow SVNKit
> to write to a subdirectory?
>
>
>
> Thanks for any help you can provide.
>
>
>
> -Jim-
>
>

Reply via email to