Google Code Hosting – svn import

I’ve just started a new project on Google Code Hosting (of which more later). I’ve been developing it in a local svn repository, and I’d like to transfer it up to the google svn server.

This isn’t easy. Google help has How do I import an existing Subversion repository?, but that’s only half the answer. The problem is that I develop many projects in one single repository (I find it easier to manage). So I wanted to export a subset of my repository to google.

Sadly, svnsync doesn’t support that.

The workaround is simple (yet tiresome). You have to create a mini-repository containing just the subset of the original repository you want, then send that to google. This is what I came up with to export just /project.

  % svnadmin create /tmp/project-repos
  % svnadmin dump -q /home/svn/public |
  > svndumpfilter include /project --renumber-revs -drop-empty-revs |
  > svnadmin load -q /tmp/project-repos

Of course, now that I have the subset isolated, the path structure is wrong. Everything is living under /project/trunk instead of /trunk. So, we have to fix that.

  % svn mv file:///tmp/project-repos/project/trunk file:///tmp/project-repos/
  % svn rm file:///tmp/project-repos/project -m 'No longer needed.'

Finally, I can use svnsync to send the changes to google:

  % svnsync init --username file:///tmp/project-repos
  % svnsync sync --username file:///tmp/project-repos

Phew. What a palaver. It would have been nice if they could accept a file containing the output of svnadmin dump instead…

One Comment to Google Code Hosting – svn import

  1. Alastair says:


    Just what I was looking for.