Backing up Google Code projects

Google Code does not provide it’s own usable export methods for projects so we need to make do on our own, there seems no sane way to back up the tickets but for SVN which includes the wiki you can use svnsync.

Here’s a little script to automate this, just give it a PREFIX of your choice and a list of projects in the PROJECTS variable, cron it and it will happily keep your repos in sync.

It outputs its actions to STDOUT so you should add some redirect or redirect it from cron.

#!/bin/bash
 
PROJECTS=( your project list )
PREFIX="/path/to/backups"
 
[ -d ${PREFIX} ] || mkdir -p ${PREFIX}
 
cd ${PREFIX}
 
for prj in ${PROJECTS[@]}
do
    if [ ! -d ${PREFIX}/${prj}/conf ]; then
        svnadmin create ${prj}
 
        ln -s /bin/true ${PREFIX}/${prj}/hooks/pre-revprop-change
 
        svnsync init file:///${PREFIX}/${prj} http://${prj}.googlecode.com/svn
    fi
 
    svnsync sync file:///${PREFIX}/${prj}
done

I stongly suggest you backup even your cloud hosted data.

Tags: ,

2 Responses to “Backing up Google Code projects”

  1. Neil Blakey-Milner 13. Jan, 2010 at 09:03 #

    I’ve been using svnsync lately for a write-through Subversion cache for remote SVN servers (Ah, South African connectivity…). A cute hack I found for setting up pre-revprop-change:

    ln -s /bin/true hooks/pre-revprop-change

  2. R.I. Pienaar 13. Jan, 2010 at 10:41 #

    That’s a good hack and like most good hacks totally obvious in hindsight :P

    will adjust my code

Leave a Reply