Open Design and Integration Environment

Update of "Converting SVN to Fossil"
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2018 Conference, Houston/TX, US, Oct 15-19
Send your abstracts to tclconference@googlegroups.com or submit via the online form
by Aug 20.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: 5770aa97ae5f5cf1eb77e35befb265449ba624d7
Page Name:Converting SVN to Fossil
Date: 2013-12-08 11:33:52
Original User: hypnotoad
Parent: 81dcdfb0b0143d26084f124575c4a5f8576d0c5d
Content

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

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

#!/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