CVS to Git Migration

I have recently been migrating our old CVS repository over to Git so we can finally eliminate any need to see CVS ever again.  To do this I am using cvs2git which I downloaded directly from …. and installed.

Since the CVS repository is on and old Linux machine and the Git Repository is running on a new Windows Server 2012 instance I used a directory share on the Linux box to allow the Windows box to see the export files and wrote these two batch files, cvsx (CVS Export) and loadGit:

cvsx:

Export the CVS repository using cvs2svn to a blobfile and a dumpfile needed to import in to GIT.  I did find that the “–fallback-encoding=utf_8” was required as well.

This takes one argument which is the project name in our local CVS repository.

#/bin/sh
cd ~/cvs2svn-2.4.0
mkdir /home/huffman/GIT_Import/$1
./cvs2git -v --fallback-encoding=utf_8 --blobfile=/home/huffman/GIT_Import/$1/git-blob.dat --dumpfile=/home/huffman/GIT_Import/$1/git-dump.dat --username=huffman /cvsroot/$1

loadGit.bat:

The loadGit is a simple batch file that creates a new Git repository and loads the blobfile and dumpfile data to populate the repository.  The batch file is run from the GIT repository home and relies on mapping the Z: drive to the linux network folder.

It also takes one argument which is the project name which will also be the repository name:

git init --bare %1.git
pushd %1.git
if EXIST git-marks.dat (
 del git-marks.dat
)
git fast-import --export-marks=git-marks.dat < Z:\%1\git-blob.dat
git fast-import --import-marks=git-marks.dat < Z:\%1\git-dump.dat
popd

With these scripts I was easily able to migrate the repositories and put an end to CVS for our group.

 

Leave a Reply

Your email address will not be published. Required fields are marked *