Open Design and Integration Environment

Converting SVN to Fossil
Bounty program for improvements to Tcl and certain Tcl packages.
Learn more about Tcl/Tk at
Full List of Project Mirrors:

Migrating from SVN to Fossil requires an intermediary trip through GIT.

Much of the code to do this was cribbed from instructions on link.


	echo $1
	exit 1


# parameters:
# 1 - username of admin
# 2 - svn repository to convert
# 3 - name of fossil repo
# note: the repository will be created right here!

if [ "$3" == "" ]
	echo "Syntax:"
	echo "  svn2fossil username  svn-repo-url  fossil-repo-name"
	die  "Please make sure you have all three parameters set!"

echo "Getting user names..."

svn log "$2" | grep '^r[0-9]' | cut -f3 -d' ' | sort -u > $fossilusers || die "Something went wrong getting user names"

echo "Converting user names to usable format..."
sed -e 's/.*/& = & <&>/' $fossilusers > $authors || die "Could not convert user names"

echo "Importing from SVN to git.  This will take some time, be patient!"

git svn clone --authors-file=$authors --username="$1" --no-metadata "$2" tmp || die "Unable to import to git"

echo "Importing from git to fossil.  This will also take some time, sadly"

cd tmp
git fast-export --full-tree --all | fossil import --git ../$3 || die "Unable to import into fossil"

echo "Adding users to fossil repository:"
for user in `cat $fossilusers`
	fossil user new $user '' "${user}1234" -R $3
	fossil user capabilities $user 'v' -R $3