The procedure I used to convert the repo cerebrum_sites
from CVS to Git.
Based on http://www.embecosm.com/appnotes/ean11/ean11-howto-cvs-git-1.0.html.
Install cvsclone
and its dependency flex
:
sudo yum install flex git-cvs
git clone [email protected]:akavel/cvsclone.git
cd cvsclone
make all
Set the following absolute paths:
CVSROOT # the CVS repository to convert
CVSMODULE # the CVS module to convert
GITBRANCH # the Git branch to create
SRCDIR # source directory for storing initial local copy of CVS repo
DESTDIR # destination directory for module specific CVS repo
GITDIR # destination directory for module specific Git repo
The following function syncronizes out modules from the cloned CVS repo, and must be sourced:
# Function for syncing file out of repository
synccvs() {
# Make sure parent directory works, otherwise rsync fails
mkdir -p `dirname ${DESTDIR}/${1}`
# Firstly if directory, rsync dir
if test -d ${SRCDIR}/${1}; then
rsync -avz ${SRCDIR}/${1}/ ${DESTDIR}/${1}
return
fi
# Next, if file not in attic, rsync that
if test -e ${SRCDIR}/${1},v; then
rsync -avz ${SRCDIR}/${1},v ${DESTDIR}/${1},v
return
fi
# Finally, check if file in attic, then rsync that
if test -e `dirname ${SRCDIR}/${1}`/Attic/`basename ${SRCDIR}/${1}`,v; then
mkdir -p `dirname ${DESTDIR}/${1}`/Attic
rsync -avz `dirname ${SRCDIR}/${1}`/Attic/`basename ${SRCDIR}/${1}`,v \
`dirname ${DESTDIR}/${1}`/Attic/`basename ${DESTDIR}/${1}`,v
return
fi
echo "Path doesn't exist! ${1}"
exit 1
}
The CVS repo must be cloned completely, not just checked out. Then the correct module is synced out with the above function.
cd ${SRCDIR}
cvsclone -d ${CVSROOT} ${CVSMODULE}
synccvs
cvs -d ${DESTDIR} init
Then we import the CVS module we just synced out into Git:
CVSPSFILE=`echo ${DESTDIR} | sed 's/\//\#/g'`
rm -Rf ~/.cvsps/${CVSPSFILE}*
git cvsimport -d ${DESTDIR} -C ${GITDIR} -p -z,120 -o ${GITBRANCH} -k ${CVSMODULE}
Warning: commit message did not conform to UTF-8.
You may want to amend it after fixing the message, or set the config
variable i18n.commitencoding to the encoding your project uses.
The most important step:
yum remove cvs