Using cvs2git » History » Version 7

Version 6 (Marc Mengel, 11/16/2012 10:08 AM) → Version 7/13 (Marc Mengel, 11/16/2012 10:09 AM)

h1. Using cvs2git

p. Some users have expressed an interest in migrating their existing CVS repositories
to Git. This wiki page will attempt to walk you through the process. We'll be showing
the commands you type and the output you get in the following format:

p{border:1px solid black}. *@command you type@*
@output you get@

p. There are a few steps to converting CVS modules to Git here on cdcvs:

* Finding your existing cvs module
* checking for space requirements
* environment setup
* running cvs2git
* undumping into the repository
* cleanup

We'll go through them in detail.

h2. Finding your existing module

You need to know the $CVSROOT value for your repository for this part. You can look in a checked-out
copy at the CVS/Root file if you're not sure what it is. The examples here will be as if you had a Redmine-created
repository 'myproject', which would have a $CVSROOT value of

You want to ssh into cdcvs using the user@cdcvs part of your $CVSROOT.

p{border:1px solid black}. *@ssh*
@Last login: ...@

Then change directories to the directory part of your $CVSROOT.

p{border:1px solid black}. *@cd /cvs/projects/myproject@*
@CVSROOT myproject@

h2. Check for space

There needs to be at least double the space your package takes free for the conversion.

p{border:1px solid black}. *@du -sk myproject@*
@800 myproject@
*@df -k .@*
@Filesystem   1K-blocks     Used Available Use% Mounted on@
@blue1:/cdcvs 314572800 240312928 74259872 77% /cvs@

So the Available space (the 74259872 in the above example) must be atleast double the size of the project (800 in the above example) to consider proceeding. If it isn't, or it's within 10% or so, please put in a servicedesk ticket, and ask us to grow the filesystem.

h2. Setup your environment

You'll probably need to use the cvs 1.12 that we use behind Redmine to do the conversion, and with
our /usr/local/bin/cvs_wrap script to hide some WARNINGS it gives that cvs2git doesn't like.

p{border:1px solid black}. *@. /fnal/ups/etc/*
*@setup cvs v1_12_13p1@*
*@echo $CVS_DIR@*
*@setup git@*
*@echo $GIT_UPS_DIR@*

h2. Run the cvs2git tool

p{border:1px solid black}. *@ cvs2git \@*
*@   --blobfile=cvs2svn-tmp/git-blob.dat \@*
*@   --dumpfile=cvs2svn-tmp/git-dump.dat \@*
*@   --username=cvs2git \@*
*@   --cvs=/usr/local/bin/cvs_wrap \@*
*@   --cvs=/usr/local/bin/cvs_wrap \@*
*@   `pwd`/my-module@*
@Examining all CVS ',v' files...@
@Timings (seconds):@
@ 9.43 pass1 CollectRevsPass@
@ 0.03 pass2 CleanMetadataPass@
@ 0.01 pass3 CollateSymbolsPass@
@10.05 total@

Then actually setup the git repository, and pull in the dump that cvs2git made

p{border:1px solid black}. *@ mkdir myproject.git@*
*@ cd myproject.git@*
*@ git init --bare --shared@*
*@ git update-server-info@*
*@ cat ../cvs2svn-tmp/git-blob.dat ../cvs2svn-tmp/git-dump.dat | git fast-import@*
*@ git gc --prune=now@*

h2. Clean up

p{border:1px solid black}. *@ cd .. @*
*@ rm -rf cvs2svn-tmp @*