svn migration Wide

This page illustrates how to migrate your cvs repository to sourceforge's svn repository on Mac OS X.

Preparation

  • darwinports - for installing cvs2svn; Fink also works, I guess
  • cvs2svn - available through port
    $ port install cvs2svn

Specifying mime-type and eol-style for each file.

cvs2svn on Mac OS X sets 'native' to eol-style (End Of File style) on all files in a converted repository, which breaks breaks binary files. So You need to specify mime-types and property in a file (say prop.txt as shown below).

[auto-props]
*.rb = svn:eol-style=native;;svn:mime-type=text/plain
*.m = svn:eol-style=native;;svn:mime-type=text/plain
*.h = svn:eol-style=native;;svn:mime-type=text/plain
*.txt = svn:eol-style=native;;svn:mime-type=text/plain
*.plist = svn:eol-style=native;;svn:mime-type=text/plain
*.pbxproj = svn:eol-style=native;;svn:mime-type=text/plain
*.icns = svn:mime-type=application/octet-stream
*.in = svn:eol-style=native;;svn:mime-type=text/plain
*.tiff = svn:mime-type=image/tiff
*.aiff = svn:mime-type=audio/x-aiff
*.aif = svn:mime-type=audio/x-aiff
*.mp3 = svn:mime-type=audio/mpeg
*.m4a = svn:mime-type=audio/mp4a-latm
*.strings = svn:mime-type=application/octet-stream
*.nib = svn:mime-type=application/octet-stream

Note: nib file is either binary or text file so let it be binary at this time.

Test conversion

To check if these properties and mime-types work as you expect, run the following command to create a test svn repository for your cvs files. I assume the svn repository is MiniKidsGames and the cvs repository is cvs-copy/MiniKidsGames (the command is actually one line)

$ cvs2svn -v --eol-from-mime-type --no-default-eol --auto-props=props.txt \
   -s MiniKidsGames cvs-copy/MiniKidsGames 2>&1 | tee conv.log

See conv.log if there is any {} closure, which means there is a missing mime-type or eol-style for a file. if you see these closures, you need to add entries to the autoprop file for converting the files as you expect.

CVS to SVN Conversion

Creating SVN dump file

I have three CVS repositories to be converted to SVN so I made a shell script to do so.

PROJECT=minikidsgames
CVSROOT=$HOME/tmp/$PROJECT-cvs
FILES='MiniKidsGames XcodeTemplates AddOnGames/Tank'

rm -rf /tmp/work /tmp/$PROJECT

for i in $FILES; do
echo converting $i
if [ ! -f /tmp/`basename $i`.svndump ]; then
  cvs2svn --symbol-transform="GAMES:MiniKidsGames" \
        --symbol-transform="TANK:Tank" \
        --symbol-transform="DEV:Dev" \
        --symbol-transform="RELEASE:Release" \
        --symbol-transform="_:." \
        --eol-from-mime-type \
        --no-default-eol --auto-props=props.txt \
        --dumpfile=/tmp/`basename $i`.svndump \
        $CVSROOT/$i > conv-`basename $i`.log
else
  echo "Skip converting $i as it already exists"
  echo "If you want to start over, remove /tmp/`basename $i` and try again."
fi
done

Note: --symbol-transform parameter specifies how to convert CVS tags to SVN tags. As svn tags can handle '.' (dot) properly, so I converted '_' into '.' in "<BEFORE>:<AFTER>" format.

Creating local svn repository

As there are three repositories to be stored into the sourceforge's SVN repository, you need to create a local svn repository that contains three sub-directories.

#!/bin/sh
PROJECT=minikidsgames
FILES='MiniKidsGames XcodeTemplates AddOnGames/Tank'

# create an empty svn repository as an fsfs filesystem.
svnadmin create /tmp/$PROJECT --fs-type fsfs
mkdir -p /tmp/work; cd /tmp/work
# check out and create empty directories
svn co file:///tmp/$PROJECT $PROJECT
cd $PROJECT
for i in $FILES; do
  mkdir -p $i
  if [ `basename $i` != $i ]; then
    svn add `dirname $i`
  else
    svn add $i
  fi
done
# check in
svn ci -m 'Created sub-directories'

# load dump files into the repository
cd /tmp
for i in $FILES; do
  svnadmin load --parent-dir $i $PROJECT < /tmp/`basename $i`.svndump > \
  load-`basename $i`.log
done

Dump the local svn repository

Now you have everything in your local svn repository. Make a dump file of this by doing:

$ svnadmin dump local_repository > svndump
$ gzip svndump

This makes svndump.gz. You can migrate individual dump files but it takes longer since you can migrate one dump file at a time at the sourceforge migration tool. Migration process takes from seconds to hours depending on a queue so it's better to make one dumpfile.

Migrating the dumpfile to sourceforge

This is the last step, and could be the most time consuming process. Copy the svn dumpfile to the top directory of your project (e.g. /home/groups/y/yo/yourproject):

$ rsync -aze 'ssh -l <your_id>' svndump.gz shell.sf.net:/<top directory>

Okay, you're ready to migrate. go to your project's subversion admin page and follow the migration instruction.

Leave a comment

Begin the comment with //pukiwiki if you want to write a comment in PukiWiki format.

You must be logged in to post a comment.