Artifact 5770aa97ae5f5cf1eb77e35befb265449ba624d7:
Wiki page
[
Converting SVN to Fossil] by
hypnotoad
2013-12-08 11:33:52.
D 2013-12-08T11:33:52.015
L Converting\sSVN\sto\sFossil
P 81dcdfb0b0143d26084f124575c4a5f8576d0c5d
U hypnotoad
W 1525
Migrating from SVN to Fossil requires an intermediary trip through GIT.
<p>
Much of the code to do this was cribbed from instructions on sqlite.org. <a href="http://www.sqlite.org/debug1/wiki?name=Cookbook">link</a>.
<p>
<verbatim>
#!/bin/bash
die(){
echo $1
exit 1
}
authors='authors.txt'
fossilusers='users.txt'
# 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" == "" ]
then
echo "Syntax:"
echo " svn2fossil username svn-repo-url fossil-repo-name"
die "Please make sure you have all three parameters set!"
fi
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`
do
fossil user new $user '' "${user}1234" -R $3
fossil user capabilities $user 'v' -R $3
done
</verbatim>
Z 4d83453de72aee7d779afc3d494086cb