Converting RCS to X

From Applied Optics Wiki
Jump to: navigation, search

You have an old RCS repository you'd like to convert to something more modern. RCS is so old that there aren't many tools that deal with it, so there are a few stages to go through.

The examples here use the name "vxi11" as the repository being converted. Change this as necessary!

First off, make sure all of the files are checked in. This probably involves "ci".

rcs2cvs

Next, we're going to make a temporary CVS repository with the contents of the RCS repository:

mkdir ~/cvs
export CVSROOT=~/cvsroot
mkdir ~/cvs/vxi11
cp /path/to/repo/vxi11/RCS/*,v ~/cvs/vxi11/

You can now check out a copy of the CVS repository like so:

mkdir ~/tmp
cd ~/tmp
cvs co vxi11 vxi11

cvs2svn

cvs is old and nasty as well, so converting to something else makes sense. For many years, the standard version control system has been Subversion (svn) and because it is the most commonly used VCS, everything has a tool to convert from SVN to their own native format. cvs2svn is in the openSUSE repositories:

sudo zypper install cvs2svn
mkdir ~/svn
cvs2svn ~/cvs/vxi11 -s ~/svn/vxi11

You can now check out a copy of the svn repository like so:

mkdir ~/tmp
cd ~/tmp
svn co file:///home/<username>/svn/vxi11 vxi11


hgsvn

svn is a big improvement over cvs, but distributed version control systems (DVCS) are the way forwards these days. The big three are git, mercurial (hg) and bazaar (bzr). I personally find mercurial nicest, and it's also very easy to set up repository access via the web.

hgsvn can be used to migrate from svn to mercurial. This isn't in the default repos, so we'll need to add another repo:

sudo zypper ar -t rpm-md http://download.opensuse.org/repositories/devel://tools://scm/openSUSE_11.1 scm-repo
sudo zypper install hgsvn

Now to do the conversion:

mkdir -p ~/hg/
cd ~/hg
hgimportsvn file:///home/<username>/svn/vxi11/trunk vxi11
cd vxi11
hgpullsvn

~/hg/vxi11 is now a mercurial repository.

The hgsvn scripts are actually designed so that you can work on code in an svn repository but use mercurial as well. This means that the svn files are left untouched. To delete them, use this:

cd ~/hg/vxi11/
find . -name '.svn' -exec rm -r {} \;

See Using hg for instructions on day to day use of hg.

svn2bzr

svn is a big improvement over cvs, but distributed version control systems (DVCS) are the way forwards these days. The big three are git, mercurial (hg) and bazaar (bzr).

We're going to use bzr-svn to migrate to bzr. This isn't in the default repos, so we'll need to add another repo:

sudo zypper ar -t rpm-md http://download.opensuse.org/repositories/home:/maw:/bzr/openSUSE_11.1 bzr-repo
sudo zypper install bzr-svn

Now to do the conversion:

mkdir -p ~/bzr/vxi11
cd ~/bzr/vxi11
bzr init
bzr pull file:///home/<username>/svn/vxi11/trunk

If you get an error about "different rich-root support", try the following:

bzr upgrade --rich-root-pack
bzr pull file:///home/<username>/svn/vxi11/trunk

~/bzr/vxi11 is now a bzr repository.

See Using bzr for instructions on day to day use of bzr.