Posted to tcl by hypnotoad at Tue Nov 10 20:37:04 GMT 2015view pretty

#!/bin/bash

die(){
        echo $1
        exit 1
}

# parameters:
# 1 - username of admin
# 2 - cvs repository to convert
# 3 - module in cvs to convert
# 4 - name of fossil repo (no extension)
# note: the repository will be created right here!

if [ "$4" == "" ] ; \
then
        echo "Syntax:"
        echo " cvs2fossil username  cvsroot module fossil-repo-name"
        die  "Please make sure you have all three parameters set!"
fi

echo "Importing from CVS to git.  This will take some time, be patient!"
mkdir $4
cd $4
cvs -d $2 login
chmod -R 777 .
git cvsimport -v -d $2 $3 || die "Unable to import to git"

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

(
git fast-export --full-tree --all | fossil import --git ../$4.fossil || die "Unable to import into fossil"
)

echo "Done!."
fossil user new $1 -R ../$4.fossil
fossil user capabilities $1 'v' -R ../$4.fossil