svngitmigrationgit-svnsvk

How to migrate an svk repository to git, with history?


I have an svk repo that was full of mirrors and locals etc, I cleaned it up in steps, because I'm trying to get rid of it, and evaluating what should stay. There's only one project there that I want to keep working on, and for that I want to migrate it to git so I can be done with svk for good.

It's located in //local/foo, it has no svn repository.

So, what I think I want to do is create a local empty svn repository and push the changes from svk to it, and then use git svn to clone it.

But it's been so long since I last used svk I have no longer any idea how to go about that.

If one svk user would be so kind to point me the way…

This is almost helpful, but it doesn't commit with history to svn, it just does a single commit.


Solution

  • Ok, I figured it out:

    # create a local svn repo
    cd $HOME/src/svk
    svnadmin create foosvn
    
    # mirror that in svk
    svk mirror file://$HOME/src/svk/foosvn //mirror/foosvn
    svk sync //mirror/foosvn
    
    # finally, merge your local svk path into the new svn repo
    svk smerge --incremental --baseless //local/foo //mirror/foosvn
    
    # Just to be sure things migrated properly:
    svn log file://$HOME/src/svk/foosvn
    
    # Now, from svn to git
    git svn clone file://$HOME/src/svk/foosvn foogit
    
    # Again, just to be sure things migrated properly:
    cd foogit
    git log --pretty=oneline --abbrev-commit
    

    That's it. Then I did a bit of clean up:

    mv $HOME/src/svk/foogit $HOME/src/foo.git
    rm -rf mv $HOME/src/svk
    # This gets rid of your entire svk existence. 
    # Be very sure you really want to do this.
    rm -rf $HOME/.svk