Wednesday, July 29, 2009

Importing CVS into SVN with history

Converting old CVS repos and their history is a question that always comes up. So heres a mini-howto convert cvs to svn and preserve the history.

Firstly install cvs2svn, on Debian based distros you can grab it with apt:
sudo apt-get install cvs2svn

cvs2svn can also be downloaded from

First we need to setup a place to work and create a CVSROOT dir else cvs2svn wont be happy.
mkdir -p ~/oldcvs/CVSROOT
mkdir ~/newsvn/

Now lets copy the CVS repo's data into ~/oldcvs/modulename
cp -r /path/to/cvs/modulename /home/user/oldcvs/modulename
cvs2svn --encoding=iso8859_10 --dumpfile=/home/user/newsvn/modulename.SVN ~/oldcvs/modulename
for Encodings check
also dumpfile didnt like the ~ in the path so full path needed here!

If all goes well you should end up with a nice report of all the revisions and their mother.
Now we need to import our newly create .SVN file into subversion, in my case I need to create a new project for it aswell like so:
svnadmin create /path/to/svn/repos/modulename

Then just import the dump into our SVN repo we created earlier
svnadmin load /path/to/svn/repos/modulename <~/newsvn/modulename.SVN

All done.

No comments:

Post a Comment