« Return to Thread: Mirroring svn functionality with SVNKit

Mirroring svn functionality with SVNKit

by quadelirus :: Rate this Message:

Reply to Author | View in Thread

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

 « Return to Thread: Mirroring svn functionality with SVNKit