#!/bin/sh

# convert Subversion repository (in BDB format hopefully) to fsfs

if [ -z "$1" ] ; then
	echo "usage: $0 path/to/svn/repository"
	exit
fi

rep=$1
type=`cat $rep/db/fs-type`

if [ "$type" == "bdb" ] ; then
	echo -n "$1 is $type, converting to fsfs"

	svnadmin create --fs-type=fsfs $rep-fsfs
	( svnadmin dump $rep | svnadmin load $rep-fsfs 2>/dev/null ) && mv $rep/db $rep/db.bdb && mv $rep-fsfs/db $rep/ || exit

	rm -Rf $rep-fsfs && rm -Rf $rep/db.bdb

	echo " done"
fi
