Mirroring svn functionality with SVNKit

View: New views
7 Messages — Rating Filter:   Alert me  

Mirroring svn functionality with SVNKit

by quadelirus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Okay, I've been looking at examples and reading the SVNKit documentation, but I just can't figure out how to do something that I think should be basic and simple.

I'm writing an app to take a project from an existing version control system (not SVN) and migrate it and all its history to an SVN server. In order to do this, I have set up a repository on the remote SVN server.

My code currently works by traversing the project as it looks in the existing version control system and basically replicating it in a temporary directory. I then use the svn command line tools to add things to the repository. Basically it works like this:

Use java to create the following directories:

project/
project/trunk
project/branches
project/tags

Then use java to call "svn import path/to/project svn://path/to/repository --username=...", using Runtime.getRuntime.exec(command);

I then delete the temporarily created project directory and SVN has the new folder structure stored in it.

Next I create a project directory again and this time use java Runtime to call:

svn checkout svn://path/to/repsotory/project/trunk path/to/project --username=...

In order to create a checked out repository on the local file system.

Finally, I loop through each file in my existing versioning system, then I grab its history and for each version write it to the disk and then call

svn commit path/to/project -m "A message that has to do with the existing file"

In other words:

foreach file in existing_versioning_project:
        foreach history_version of file:
                write_to_filesystem(file)
                Runtime.getRuntime.exec("svn commit path/to/project -m...")

Okay, so this works great, except for one issue: it is really really slow and I have like 100,000 revisions to go through (I got through like 10,000 in a few hours). So I want to replace it with calls to SVNKit intsead of spawning new processes. I can see how to edit a local repository using ISVNEditor, and I can see how to get information on a remote repository, but I can't figure out how to connect a local file structure to a remote repository. In otherwords how do I exactly mirror the funcionality of

svn import
svn checkout
svn commit

using SVNKit?

I've been reading documentation and tutorials for hours, and I'm just not seeing how to put the pieces together to do this.

Thanks,
John

RE: Mirroring svn functionality with SVNKit

by Greg Gibeling-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

        It sounds like you may have been looking at the low level
interfaces, my advice having written something like before would be to check
the javadocs for these two classes:
http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/wc/SVNCommitClient.html
and
http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/wc/SVNUpdateClient.html.
        The only thing left is that to get instances of those you'll need an
ISVNAuthenticationManager.

-Greg

> -----Original Message-----
> From: quadelirus [mailto:john.bowers@...]
> Sent: Thursday, June 11, 2009 6:49 AM
> To: svnkit-users@...
> Subject: Mirroring svn functionality with SVNKit
>
>
> Okay, I've been looking at examples and reading the SVNKit
> documentation, but
> I just can't figure out how to do something that I think should be
> basic and
> simple.
>
> I'm writing an app to take a project from an existing version control
> system
> (not SVN) and migrate it and all its history to an SVN server. In order
> to
> do this, I have set up a repository on the remote SVN server.
>
> My code currently works by traversing the project as it looks in the
> existing version control system and basically replicating it in a
> temporary
> directory. I then use the svn command line tools to add things to the
> repository. Basically it works like this:
>
> Use java to create the following directories:
>
> project/
> project/trunk
> project/branches
> project/tags
>
> Then use java to call "svn import path/to/project
> svn://path/to/repository
> --username=...", using Runtime.getRuntime.exec(command);
>
> I then delete the temporarily created project directory and SVN has the
> new
> folder structure stored in it.
>
> Next I create a project directory again and this time use java Runtime
> to
> call:
>
> svn checkout svn://path/to/repsotory/project/trunk path/to/project
> --username=...
>
> In order to create a checked out repository on the local file system.
>
> Finally, I loop through each file in my existing versioning system,
> then I
> grab its history and for each version write it to the disk and then
> call
>
> svn commit path/to/project -m "A message that has to do with the
> existing
> file"
>
> In other words:
>
> foreach file in existing_versioning_project:
> foreach history_version of file:
> write_to_filesystem(file)
> Runtime.getRuntime.exec("svn commit path/to/project -m...")
>
> Okay, so this works great, except for one issue: it is really really
> slow
> and I have like 100,000 revisions to go through (I got through like
> 10,000
> in a few hours). So I want to replace it with calls to SVNKit intsead
> of
> spawning new processes. I can see how to edit a local repository using
> ISVNEditor, and I can see how to get information on a remote
> repository, but
> I can't figure out how to connect a local file structure to a remote
> repository. In otherwords how do I exactly mirror the funcionality of
>
> svn import
> svn checkout
> svn commit
>
> using SVNKit?
>
> I've been reading documentation and tutorials for hours, and I'm just
> not
> seeing how to put the pieces together to do this.
>
> Thanks,
> John
>
> --
> View this message in context: http://www.nabble.com/Mirroring-svn-
> functionality-with-SVNKit-tp23981657p23981657.html
> Sent from the SVNKit - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svnkit-users-unsubscribe@...
> For additional commands, e-mail: svnkit-users-help@...



---------------------------------------------------------------------
To unsubscribe, e-mail: svnkit-users-unsubscribe@...
For additional commands, e-mail: svnkit-users-help@...


RE: Mirroring svn functionality with SVNKit

by quadelirus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Greg,

Don't know how I hadn't come across these--they look like they'll do exactly what I need. In the meantime I have figured out a little more about using the low level API and I think I'm starting to get a handle on it.

Would it be faster to use the low level API and create text deltas from java strings than writing out files to the file system and using SVNCommitClient? Or is the speed difference probably negligible and therefore the ease-of-use with SVNCommitClient makes it the definite way to go?

Thanks,
John

RE: Mirroring svn functionality with SVNKit

by quadelirus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Below is how I'm currently trying to mirror what I was doing before. Every thing works up to the svn commit comment. I'm trying to use the low level API still so that I don't have to write to the filesystem. My files will be generated by strings. The code below appropriately sets up my SVN project and writes the first version of test.txt to the trunk/ directory (which reads "This is a test document").

When I try to commit a change to this document, namely to make it "This is a test document for SVN." I get an svn: Malformed network data error.

I would really like to just use strings and not have to write them out to the file system since that is how I get the file versions from my existing versioning control system.

If I can get this commit working, I'll have everything I need to migrate my stuff to SVN.

Thanks,
John

//Setup the repository:
SVNRepositoryFactoryImpl.setup();
SVNRepository repository;
repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(serverURL), null);

//Authenticate:
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(username, password);
repository.setAuthenticationManager(authManager);

//Create the ISVNEditor and SVNDeltaGenerator objects
ISVNEditor svnEditor = repository.getCommitEditor("log message", null, true, null);
SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();

//svn import (creates project/trunk, project/branches and project/tags)
svnEditor.openRoot(-1);
svnEditor.addDir(svnConfigurationPage.getProjectName(), null, -1);
svnEditor.addDir(svnConfigurationPage.getProjectName() + "/trunk", null, -1);
svnEditor.closeDir();
svnEditor.addDir(svnConfigurationPage.getProjectName() + "/branches", null, -1);
svnEditor.closeDir();
svnEditor.addDir(svnConfigurationPage.getProjectName() + "/tags", null, -1);
svnEditor.closeDir();
svnEditor.closeDir();
svnEditor.closeDir();
svnEditor.closeEdit();

//svn add (adds project/trunk/test.txt)
svnEditor = repository.getCommitEditor("log message", null, true, null);
svnEditor.openRoot(-1);
svnEditor.addFile(svnConfigurationPage.getProjectName() + "/trunk/test.txt", null, -1);
svnEditor.applyTextDelta(svnConfigurationPage.getProjectName() + "/trunk/test.txt", null);
InputStream contentsStream = new ByteArrayInputStream("This is a test document".getBytes("UTF-8"));
String checkSum = deltaGenerator.sendDelta(svnConfigurationPage.getProjectName() + "/trunk/test.txt", contentsStream, svnEditor, true);
svnEditor.closeFile(svnConfigurationPage.getProjectName() + "/trunk/test.txt", checkSum);
svnEditor.closeDir();
svnEditor.closeEdit();

//svn commit (commits a change to project/trunk/test.txt--NOT WORKING)
svnEditor = repository.getCommitEditor("log message", null, true, null);
svnEditor.openRoot(-1);
svnEditor.openFile(svnConfigurationPage.getProjectName() + "/trunk/test.txt", -1);
svnEditor.applyTextDelta(svnConfigurationPage.getProjectName() + "/trunk/test.txt", null);
contentsStream = new ByteArrayInputStream("This is a test document".getBytes("UTF-8"));
InputStream contentsStream2 = new ByteArrayInputStream("This is a test document for SVN.".getBytes("UTF-8"));
checkSum = deltaGenerator.sendDelta(svnConfigurationPage.getProjectName() + "/trunk/test/txt", contentsStream, 0, contentsStream2, svnEditor, true);
svnEditor.closeFile(svnConfigurationPage.getProjectName() + "/trunk/test/txt", checkSum);
svnEditor.closeDir();
svnEditor.closeEdit();

Re: Mirroring svn functionality with SVNKit

by Alexander Sinyushkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi John,

Here

 > svnEditor.openRoot(-1);
 > svnEditor.openFile(svnConfigurationPage.getProjectName() +
 > "/trunk/test.txt", -1);

you can not open files this way. It must be done in sequence opening all
the intermediate directories:

svnEditor.openRoot(-1);
svnEditor.openDir(svnConfigurationPage.getProjectName()...);
svnEditor.openDir(svnConfigurationPage.getProjectName()+"/trunk"...);
svnEditor.openFile(svnConfigurationPage.getProjectName() +
"/trunk/test.txt",..);
...

----
Alexander Sinyushkin,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!

quadelirus wrote:

> Below is how I'm currently trying to mirror what I was doing before. Every
> thing works up to the svn commit comment. I'm trying to use the low level
> API still so that I don't have to write to the filesystem. My files will be
> generated by strings. The code below appropriately sets up my SVN project
> and writes the first version of test.txt to the trunk/ directory (which
> reads "This is a test document").
>
> When I try to commit a change to this document, namely to make it "This is a
> test document for SVN." I get an svn: Malformed network data error.
>
> I would really like to just use strings and not have to write them out to
> the file system since that is how I get the file versions from my existing
> versioning control system.
>
> If I can get this commit working, I'll have everything I need to migrate my
> stuff to SVN.
>
> Thanks,
> John
>
> //Setup the repository:
> SVNRepositoryFactoryImpl.setup();
> SVNRepository repository;
> repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(serverURL),
> null);
>
> //Authenticate:
> ISVNAuthenticationManager authManager =
> SVNWCUtil.createDefaultAuthenticationManager(username, password);
> repository.setAuthenticationManager(authManager);
>
> //Create the ISVNEditor and SVNDeltaGenerator objects
> ISVNEditor svnEditor = repository.getCommitEditor("log message", null, true,
> null);
> SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
>
> //svn import (creates project/trunk, project/branches and project/tags)
> svnEditor.openRoot(-1);
> svnEditor.addDir(svnConfigurationPage.getProjectName(), null, -1);
> svnEditor.addDir(svnConfigurationPage.getProjectName() + "/trunk", null,
> -1);
> svnEditor.closeDir();
> svnEditor.addDir(svnConfigurationPage.getProjectName() + "/branches", null,
> -1);
> svnEditor.closeDir();
> svnEditor.addDir(svnConfigurationPage.getProjectName() + "/tags", null, -1);
> svnEditor.closeDir();
> svnEditor.closeDir();
> svnEditor.closeDir();
> svnEditor.closeEdit();
>
> //svn add (adds project/trunk/test.txt)
> svnEditor = repository.getCommitEditor("log message", null, true, null);
> svnEditor.openRoot(-1);
> svnEditor.addFile(svnConfigurationPage.getProjectName() + "/trunk/test.txt",
> null, -1);
> svnEditor.applyTextDelta(svnConfigurationPage.getProjectName() +
> "/trunk/test.txt", null);
> InputStream contentsStream = new ByteArrayInputStream("This is a test
> document".getBytes("UTF-8"));
> String checkSum =
> deltaGenerator.sendDelta(svnConfigurationPage.getProjectName() +
> "/trunk/test.txt", contentsStream, svnEditor, true);
> svnEditor.closeFile(svnConfigurationPage.getProjectName() +
> "/trunk/test.txt", checkSum);
> svnEditor.closeDir();
> svnEditor.closeEdit();
>
> //svn commit (commits a change to project/trunk/test.txt--NOT WORKING)
> svnEditor = repository.getCommitEditor("log message", null, true, null);
> svnEditor.openRoot(-1);
> svnEditor.openFile(svnConfigurationPage.getProjectName() +
> "/trunk/test.txt", -1);
> svnEditor.applyTextDelta(svnConfigurationPage.getProjectName() +
> "/trunk/test.txt", null);
> contentsStream = new ByteArrayInputStream("This is a test
> document".getBytes("UTF-8"));
> InputStream contentsStream2 = new ByteArrayInputStream("This is a test
> document for SVN.".getBytes("UTF-8"));
> checkSum = deltaGenerator.sendDelta(svnConfigurationPage.getProjectName() +
> "/trunk/test/txt", contentsStream, 0, contentsStream2, svnEditor, true);
> svnEditor.closeFile(svnConfigurationPage.getProjectName() +
> "/trunk/test/txt", checkSum);
> svnEditor.closeDir();
> svnEditor.closeEdit();

---------------------------------------------------------------------
To unsubscribe, e-mail: svnkit-users-unsubscribe@...
For additional commands, e-mail: svnkit-users-help@...


Re: Mirroring svn functionality with SVNKit

by quadelirus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks,

I changed this code but I am still getting the Malformed network data error.

Here are the relevant bits of the stack trace:

org.tmatesoft.svn.core.SVNException: svn: Malformed network data
        at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64)
        at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51)
        at org.tmatesoft.svn.core.internal.io.svn.SVNReader.readChar(SVNReader.java:467)
        at org.tmatesoft.svn.core.internal.io.svn.SVNReader.skipWhiteSpace(SVNReader.java:479)
        at org.tmatesoft.svn.core.internal.io.svn.SVNReader.readTuple(SVNReader.java:281)
        at org.tmatesoft.svn.core.internal.io.svn.SVNReader.parse(SVNReader.java:235)
        at org.tmatesoft.svn.core.internal.io.svn.SVNConnection.read(SVNConnection.java:260)
        at org.tmatesoft.svn.core.internal.io.svn.SVNCommitEditor.closeEdit(SVNCommitEditor.java:203)

Alexander Sinyushkin wrote:
Hi John,

Here

 > svnEditor.openRoot(-1);
 > svnEditor.openFile(svnConfigurationPage.getProjectName() +
 > "/trunk/test.txt", -1);

you can not open files this way. It must be done in sequence opening all
the intermediate directories:

svnEditor.openRoot(-1);
svnEditor.openDir(svnConfigurationPage.getProjectName()...);
svnEditor.openDir(svnConfigurationPage.getProjectName()+"/trunk"...);
svnEditor.openFile(svnConfigurationPage.getProjectName() +
"/trunk/test.txt",..);
...

----
Alexander Sinyushkin,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!

quadelirus wrote:
> Below is how I'm currently trying to mirror what I was doing before. Every
> thing works up to the svn commit comment. I'm trying to use the low level
> API still so that I don't have to write to the filesystem. My files will be
> generated by strings. The code below appropriately sets up my SVN project
> and writes the first version of test.txt to the trunk/ directory (which
> reads "This is a test document").
>
> When I try to commit a change to this document, namely to make it "This is a
> test document for SVN." I get an svn: Malformed network data error.
>
> I would really like to just use strings and not have to write them out to
> the file system since that is how I get the file versions from my existing
> versioning control system.
>
> If I can get this commit working, I'll have everything I need to migrate my
> stuff to SVN.
>
> Thanks,
> John
>
> //Setup the repository:
> SVNRepositoryFactoryImpl.setup();
> SVNRepository repository;
> repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(serverURL),
> null);
>
> //Authenticate:
> ISVNAuthenticationManager authManager =
> SVNWCUtil.createDefaultAuthenticationManager(username, password);
> repository.setAuthenticationManager(authManager);
>
> //Create the ISVNEditor and SVNDeltaGenerator objects
> ISVNEditor svnEditor = repository.getCommitEditor("log message", null, true,
> null);
> SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
>
> //svn import (creates project/trunk, project/branches and project/tags)
> svnEditor.openRoot(-1);
> svnEditor.addDir(svnConfigurationPage.getProjectName(), null, -1);
> svnEditor.addDir(svnConfigurationPage.getProjectName() + "/trunk", null,
> -1);
> svnEditor.closeDir();
> svnEditor.addDir(svnConfigurationPage.getProjectName() + "/branches", null,
> -1);
> svnEditor.closeDir();
> svnEditor.addDir(svnConfigurationPage.getProjectName() + "/tags", null, -1);
> svnEditor.closeDir();
> svnEditor.closeDir();
> svnEditor.closeDir();
> svnEditor.closeEdit();
>
> //svn add (adds project/trunk/test.txt)
> svnEditor = repository.getCommitEditor("log message", null, true, null);
> svnEditor.openRoot(-1);
> svnEditor.addFile(svnConfigurationPage.getProjectName() + "/trunk/test.txt",
> null, -1);
> svnEditor.applyTextDelta(svnConfigurationPage.getProjectName() +
> "/trunk/test.txt", null);
> InputStream contentsStream = new ByteArrayInputStream("This is a test
> document".getBytes("UTF-8"));
> String checkSum =
> deltaGenerator.sendDelta(svnConfigurationPage.getProjectName() +
> "/trunk/test.txt", contentsStream, svnEditor, true);
> svnEditor.closeFile(svnConfigurationPage.getProjectName() +
> "/trunk/test.txt", checkSum);
> svnEditor.closeDir();
> svnEditor.closeEdit();
>
> //svn commit (commits a change to project/trunk/test.txt--NOT WORKING)
> svnEditor = repository.getCommitEditor("log message", null, true, null);
> svnEditor.openRoot(-1);
> svnEditor.openFile(svnConfigurationPage.getProjectName() +
> "/trunk/test.txt", -1);
> svnEditor.applyTextDelta(svnConfigurationPage.getProjectName() +
> "/trunk/test.txt", null);
> contentsStream = new ByteArrayInputStream("This is a test
> document".getBytes("UTF-8"));
> InputStream contentsStream2 = new ByteArrayInputStream("This is a test
> document for SVN.".getBytes("UTF-8"));
> checkSum = deltaGenerator.sendDelta(svnConfigurationPage.getProjectName() +
> "/trunk/test/txt", contentsStream, 0, contentsStream2, svnEditor, true);
> svnEditor.closeFile(svnConfigurationPage.getProjectName() +
> "/trunk/test/txt", checkSum);
> svnEditor.closeDir();
> svnEditor.closeEdit();

---------------------------------------------------------------------
To unsubscribe, e-mail: svnkit-users-unsubscribe@svnkit.com
For additional commands, e-mail: svnkit-users-help@svnkit.com

Re: Mirroring svn functionality with SVNKit

by Alexander Sinyushkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello John,

I suppose, you've got a typo in sendDelta() and closeFile() calls. First
you call openFile on 'test.txt' as well as applyTextDelta(), but then
you call sendDelta() and closeFile() on 'test/txt':

svnEditor.openFile(svnConfigurationPage.getProjectName() +
"/trunk/test.txt", -1);

svnEditor.applyTextDelta(svnConfigurationPage.getProjectName() +
"/trunk/test.txt", null);

contentsStream = new ByteArrayInputStream("This is a test
document".getBytes("UTF-8"));

InputStream contentsStream2 = new ByteArrayInputStream("This is a test
document for SVN.".getBytes("UTF-8"));

checkSum = deltaGenerator.sendDelta(svnConfigurationPage.getProjectName() +
"/trunk/test/txt", contentsStream, 0, contentsStream2, svnEditor, true);

svnEditor.closeFile(svnConfigurationPage.getProjectName() +
"/trunk/test/txt", checkSum);

----
Alexander Sinyushkin,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!

quadelirus wrote:

> Thanks,
>
> I changed this code but I am still getting the Malformed network data error.
>
> Here are the relevant bits of the stack trace:
>
> org.tmatesoft.svn.core.SVNException: svn: Malformed network data
> at
> org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64)
> at
> org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51)
> at
> org.tmatesoft.svn.core.internal.io.svn.SVNReader.readChar(SVNReader.java:467)
> at
> org.tmatesoft.svn.core.internal.io.svn.SVNReader.skipWhiteSpace(SVNReader.java:479)
> at
> org.tmatesoft.svn.core.internal.io.svn.SVNReader.readTuple(SVNReader.java:281)
> at
> org.tmatesoft.svn.core.internal.io.svn.SVNReader.parse(SVNReader.java:235)
> at
> org.tmatesoft.svn.core.internal.io.svn.SVNConnection.read(SVNConnection.java:260)
> at
> org.tmatesoft.svn.core.internal.io.svn.SVNCommitEditor.closeEdit(SVNCommitEditor.java:203)
>
>
> Alexander Sinyushkin wrote:
>> Hi John,
>>
>> Here
>>
>>  > svnEditor.openRoot(-1);
>>  > svnEditor.openFile(svnConfigurationPage.getProjectName() +
>>  > "/trunk/test.txt", -1);
>>
>> you can not open files this way. It must be done in sequence opening all
>> the intermediate directories:
>>
>> svnEditor.openRoot(-1);
>> svnEditor.openDir(svnConfigurationPage.getProjectName()...);
>> svnEditor.openDir(svnConfigurationPage.getProjectName()+"/trunk"...);
>> svnEditor.openFile(svnConfigurationPage.getProjectName() +
>> "/trunk/test.txt",..);
>> ...
>>
>> ----
>> Alexander Sinyushkin,
>> TMate Software,
>> http://svnkit.com/ - Java [Sub]Versioning Library!
>>
>> quadelirus wrote:
>>> Below is how I'm currently trying to mirror what I was doing before.
>>> Every
>>> thing works up to the svn commit comment. I'm trying to use the low level
>>> API still so that I don't have to write to the filesystem. My files will
>>> be
>>> generated by strings. The code below appropriately sets up my SVN project
>>> and writes the first version of test.txt to the trunk/ directory (which
>>> reads "This is a test document").
>>>
>>> When I try to commit a change to this document, namely to make it "This
>>> is a
>>> test document for SVN." I get an svn: Malformed network data error.
>>>
>>> I would really like to just use strings and not have to write them out to
>>> the file system since that is how I get the file versions from my
>>> existing
>>> versioning control system.
>>>
>>> If I can get this commit working, I'll have everything I need to migrate
>>> my
>>> stuff to SVN.
>>>
>>> Thanks,
>>> John
>>>
>>> //Setup the repository:
>>> SVNRepositoryFactoryImpl.setup();
>>> SVNRepository repository;
>>> repository =
>>> SVNRepositoryFactory.create(SVNURL.parseURIEncoded(serverURL),
>>> null);
>>>
>>> //Authenticate:
>>> ISVNAuthenticationManager authManager =
>>> SVNWCUtil.createDefaultAuthenticationManager(username, password);
>>> repository.setAuthenticationManager(authManager);
>>>
>>> //Create the ISVNEditor and SVNDeltaGenerator objects
>>> ISVNEditor svnEditor = repository.getCommitEditor("log message", null,
>>> true,
>>> null);
>>> SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
>>>
>>> //svn import (creates project/trunk, project/branches and project/tags)
>>> svnEditor.openRoot(-1);
>>> svnEditor.addDir(svnConfigurationPage.getProjectName(), null, -1);
>>> svnEditor.addDir(svnConfigurationPage.getProjectName() + "/trunk", null,
>>> -1);
>>> svnEditor.closeDir();
>>> svnEditor.addDir(svnConfigurationPage.getProjectName() + "/branches",
>>> null,
>>> -1);
>>> svnEditor.closeDir();
>>> svnEditor.addDir(svnConfigurationPage.getProjectName() + "/tags", null,
>>> -1);
>>> svnEditor.closeDir();
>>> svnEditor.closeDir();
>>> svnEditor.closeDir();
>>> svnEditor.closeEdit();
>>>
>>> //svn add (adds project/trunk/test.txt)
>>> svnEditor = repository.getCommitEditor("log message", null, true, null);
>>> svnEditor.openRoot(-1);
>>> svnEditor.addFile(svnConfigurationPage.getProjectName() +
>>> "/trunk/test.txt",
>>> null, -1);
>>> svnEditor.applyTextDelta(svnConfigurationPage.getProjectName() +
>>> "/trunk/test.txt", null);
>>> InputStream contentsStream = new ByteArrayInputStream("This is a test
>>> document".getBytes("UTF-8"));
>>> String checkSum =
>>> deltaGenerator.sendDelta(svnConfigurationPage.getProjectName() +
>>> "/trunk/test.txt", contentsStream, svnEditor, true);
>>> svnEditor.closeFile(svnConfigurationPage.getProjectName() +
>>> "/trunk/test.txt", checkSum);
>>> svnEditor.closeDir();
>>> svnEditor.closeEdit();
>>>
>>> //svn commit (commits a change to project/trunk/test.txt--NOT WORKING)
>>> svnEditor = repository.getCommitEditor("log message", null, true, null);
>>> svnEditor.openRoot(-1);
>>> svnEditor.openFile(svnConfigurationPage.getProjectName() +
>>> "/trunk/test.txt", -1);
>>> svnEditor.applyTextDelta(svnConfigurationPage.getProjectName() +
>>> "/trunk/test.txt", null);
>>> contentsStream = new ByteArrayInputStream("This is a test
>>> document".getBytes("UTF-8"));
>>> InputStream contentsStream2 = new ByteArrayInputStream("This is a test
>>> document for SVN.".getBytes("UTF-8"));
>>> checkSum = deltaGenerator.sendDelta(svnConfigurationPage.getProjectName()
>>> +
>>> "/trunk/test/txt", contentsStream, 0, contentsStream2, svnEditor, true);
>>> svnEditor.closeFile(svnConfigurationPage.getProjectName() +
>>> "/trunk/test/txt", checkSum);
>>> svnEditor.closeDir();
>>> svnEditor.closeEdit();
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: svnkit-users-unsubscribe@...
>> For additional commands, e-mail: svnkit-users-help@...
>>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: svnkit-users-unsubscribe@...
For additional commands, e-mail: svnkit-users-help@...