How to import subversion into Google Code hosting

I guess, it's easy, once you know how to do it :-)

1. cache your user credentials

$ svn checkout https://webpac2.googlecode.com/svn/trunk/ webpac2 --username dpavlin 

2. install and init SVN::Mirror

$ cpanp i SVN::Mirror
$ export SVMREPOS=~/svm 
$ svm init google/ https://webpac2.googlecode.com/svn/
Committed revision 1.
$ svm sync google/
Syncing https://webpac2.googlecode.com/svn
Retrieving log information from 1 to 1
Committed revision 2 from revision 1.

3. create branch and import history

$ svn cp file://$SVMREPOS/google file://$SVMREPOS/initial_import -m "import of history"
Committed revision 3.
$ svn rm file://$SVMREPOS/initial_import/trunk -m "removed pre-created trunk"
Committed revision 4.
$ svnadmin dump ~/private/svn/webpac2/ --incremental | svnadmin load $SVMREPOS --parent-dir /initial_import

[... a lot of output ...]

4. Check if all revisions are here

$ svn info file://$SVMREPOS/initial_import/      
Path: initial_import
URL: file:///home/dpavlin/svm/initial_import
Repository Root: file:///home/dpavlin/svm/initial_import
Repository UUID: 07558da8-63fa-0310-ba24-9fe276d99e06
Revision: 663
Node Kind: directory
Last Changed Author: dpavlin
Last Changed Rev: 663
Last Changed Date: 2006-09-08 19:49:09 +0200 (Fri, 08 Sep 2006)

5. Find first revision to import (last changed in google branch+1)

$ svn info file://$SVMREPOS/google/
Path: google
URL: file:///home/dpavlin/svm/google
Repository Root: file:///home/dpavlin/svm
Repository UUID: 15ab016f-fa1c-0410-a7d3-f6d91a34b6aa
Revision: 670
Node Kind: directory
Last Changed Author: dpavlin
Last Changed Rev: 5
Last Changed Date: 2006-09-09 02:09:47 +0200 (Sat, 09 Sep 2006)

6. import other revisions (this will take forever)

$ perl -e 'print "$_\n" for ( 6 .. 670 )' | xargs -i svm mergeback google initial_import {}

7. watch progress with

$ svn log -v https://webpac2.googlecode.com/svn/

It sucks to loose timestamps, but at least you have your revisions...


Update: Lately I would reccomend to use SVN::Pusher to sync your changes. Downside is that SVN::Pusher won't work with file:/// URIs, but other that that it seems like a much easier approach. Usage goes something like this:

$ svn-pusher push -r 663:782 svn://svn.rot13.org/webpac2/ https://webpac2.googlecode.com/svn/