Moving a SVN Repository from Machine A to B


Move all files off the old machine.  Check.

Clean the dust out of the machine, keyboard, mouse ball.  Check.

Find OS and drivers discs for the machine.  Check.

Transfer local project files over.  Hmm.

See, I’ve been using SVN + TortoiseSVN on Windows for years to manage source code revisions on my projects.  Love it, but I am still a n00b when it comes to SVN.

Now that I’ve moved to a new development machine, I need to move my whole project environment along with historical commits.  Searching on the ‘net yields some good answers, but no real step-by-step for a TortoiseSVN user.

BTW lots of searches would yield “svn export”, which doesn’t exactly do what I need here – it only makes a copy of the current revisions in the repository.

OK:

  1. Backup everything
  2. Make sure your SVN version is the same on both machines (just in case)
  3. Know your repository full path.  If you don’t know it:
    1. Find the root folder for your projects
    2. Right click > TortoiseSVN > Repo-browser
    3. Note the URL, like: file:///C:/Documents and Settings/Bob/Documents/SVN Repository
    4. That path, minus the “file:///” is what you want
  4. On the command line:
    svnadmin dump “C:\Documents and Settings\Bob\Documents\SVN Repository” > projects.dmp

    If you have a lot of projects, and/or a lot of history or big files, this may take a while to run, and may create a big file.  This is your whole repository and history of changes after all.

  5. Copy this big file over to your new machine, say to D:\projects.dmp
  6. On your new machine, create a new directory for the repostory, say “D:\SVN Repository"
  7. Create the repository: Use svnadmin create, or with TortoiseSVN right click on the” folder > TortoiseSVN > Create repository here
  8. On the command line, run:
    svnadmin load “D:\SVN Repository” < projects.dmp
  9. Now you can restore all the files: create your project directory, say “D:\Projects”
  10. Right click > SVN Checkout…
  11. The URL should point to your new repository.  Now do a fully recursive checkout. 
    svn-checkout

That’s it.  Repository and all history moved over.  Check.

Props goes to Digital Media’s nice instructions that helped guide me.

Update: After I did all this, it occurred to me that since the two machines were networked together, and could see each other, I may have been able to do this:

  1. Map a drive from machine A to B
  2. Right click > TortoiseSVN > Relocate…
  3. Move the repository over
  4. Pick up from step #9 above

Haven’t tried it, so can’t vouch for it.

,