Introduction

NVDA addon creaters often start with an svn repository, then wish to migrate to git, I have been asked to write up step by step instructions for the migration, so here it is, incase its useful, mostly rephrasing of steps in 1 and 2.

Details

  1. Make a directory called convert to hold our work until we are finnished, the rest of the instructions assume that we are inside this directory.

  2. Find out the names of the committers of the project, so that their svn usernames can be mapped to name/email addresses. In an existing checkout of the repo:

      $ svn  log | grep -P "r[0-9]* \|" | awk -F\| '{print $2}'| sort | uniq >users.txt
    
  3. Edit users.txt to have this format:

     svnUsername1 = realName1 <email1>
     svnUsername2 = realName2 <email2>
    
  4. In the command line, we write the command:

     $ git svn clone --stdlayout --no-metadata -A users.txt https://svnRepoUrl/repoName 
    

    It will slowly download and convert., when its back to command prompt it should have checked out everything.

  5. from our file browser in our convert folder, we can now see a folder with the repository name, and inside it is everything that is inside trunk in our svn. We cant see branches or tags, this is normal in git.

  6. lets see what branches we have

     $ git branch -a
     * master
       remotes/detectContextMenu
       remotes/tags/2.0
       remotes/tags/3.0
       remotes/trunk
     $
    

    Some of the svn tags show up as branches, so lets just create git branches for the real svn branches, master is already trunk, and the others are our tags, so we only need to create one branch.

      $ git branch detectContextMenu remotes/detectContextMenu
    
  7. now fix the tags

     $ git tag v2.0 tags/2.0
     $ git tag v3.0 tags/3.0
     # see what tags we have:
     $ git tag
    

    should now show vv2.0 and v3.0. Now our branches and tags are correct.

  8. On bitbucket or github create new empty repository, without readme or anything, bitbucket in this example.

  9. tell git we have a remote called bitbucket and make it our default

     $ git remote add bitbucket https://mhameed@bitbucket.org/repoName
     $ git config master.remote bitbucket
     $ git config master.merge refs/heads/master
    
  10. push all our branches and tags to it, first push master branch, then everything else.

    $ git push --set-upstream bitbucket master
    $ git push --all --tags
    
  11. Remove all references to svn:

    $ git config --remove-section svn
    $ git config --remove-section remote-svn.svn
    
  12. Remove svn repository from assembla or wherever.