Subscribe Favorite

Migrating Subversion repositories using SVK

Written on March 20, 2008 by Hendy Irawan

Recently I got a task which involves moving, or let’s say copying, an entire Subversion repository with history to another server. Problem is, I didn’t have access to the server itself, which means I couldn’t do a regular “svnadmin dump”.

SVK comes to the rescue!

Firefighter in style!

To make it work, first of all you need to install SVK. In Ubuntu it goes like this:

sudo aptitude install svk

When you first run svk it’ll ask you to create a local depot, you can simply agree to its suggestion.

Now we mirror both of the Subversion repositories we’re trying to import and export from and to. Note that you need to create the destination repository first.

svk mirror //source http://svn.source.com/project1/
svk mirror //dest http://svn.dest.com/newproject/

A bit of niceness with this method instead of a regular svn dump/load procedure is that:

  • you can import to a different folder/subfolder instead of the root folder
  • you can do a partial export (subfolder of project repository)

Before doing the actual migration process, let’s sync these mirrors first:

svk sync //source
svk sync //dest

And then you’ll do the real thing. But we can simulate it first by using “–check-only”, kinda’ like when you simulate a DVD burning session before actually writing it.

svk smerge //source //dest --incremental --log --sync --verbatim --track-rename --baseless --check-only

There are several switches that I used above, feel free to use them only as needed:

  • -I [--incremental]: apply each change individually
  • -l [--log]: use logs of merged revisions as commit message
  • -B [--baseless]: use the earliest revision as the merge point
  • -s [--sync]: synchronize mirrored sources before update
  • –verbatim: verbatim merge log without indents and header
  • –track-rename: track changes made to renamed node
  • -C [--check-only]: try operation but make no changes

After you’re ready, redo the above command without “–check-only”:

svk smerge //source //dest --incremental --log --sync --verbatim --track-rename --baseless

Simply wait several minutes–or possibly hours (or days!) if your project is sufficiently large–for SVK to do its job for you!

Are there disadvantages of using SVK to a “genuine” SVN dump/load? Sure, among them is that the original author names are lost.

Good luck!

Related articles and resources:

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
If you enjoyed this post Subscribe to our feed

 

Trackbacks

(Trackback URL)

close Reblog this comment
blog comments powered by Disqus