Converting Repositories from CVS to BZR on Debian Etch

Home, Elsternwick, Australia, 2008-04-15 22:14 +1000

#software_engineering

I’ve been using Bazaar for version control for about 3 months now and it’s been working well, so it’s time to start converting some older modules that are versioned under CVS to BZR.

I hacked about a bit trying to get the conversion tool to work under Windows but since cvsps runs under Cygwin, and I was running the native Windows distro of bzr, I couldn’t get them to agree on path names. It’s possible that with some more work it could be made to work, but since my CVS server is a Debian Linux box anyway, I decided I might as well just do the conversions up there.

Here’s the process.

Initial Setup

Install Bazaar

If you don’t already have Bazaar installed, install it now. The official Debian package mirrors offer a very old version of Bazaar, so add the following lines to /etc/apt/sources.list so you can get the latest version released by Canonical:

deb http://ppa.launchpad.net/bzr/ubuntu dapper main
deb-src http://ppa.launchpad.net/bzr/ubuntu dapper main

Then make sure apt knows what’s there:

sudo apt-get update

Obviously if you’re running as su, you don’t need to sudo. Finally to install Bazaar:

sudo apt-get install bzr

And follow the usual apt-get prompts.

Install the cvsps-import Plugin for bzr

The following steps are from the CVS to Bazaar importer page on launchpad.net:

mkdir -p ~/.bazaar/plugins
cd ~/.bazaar/plugins
bzr checkout lp:bzr-cvsps-import cvsps_import

This installs the plugin in your personal Bazaar plugins directory. If you want to make it available for all users on the box, you’ll need to install it in the central plugin directory. See the Bazaar docs for where that is.

To verify that the plugin installed correctly, run the bzr plugins and you should see the cvsps-import plugin listed:

brendonm@mothership:~$ bzr plugins
cvsps_import
    A plugin for converting from CVS to bzr using a cvsps
    changeset listing.

launchpad
    Launchpad.net integration plugin for Bazaar.

If you get an error message something like this:

bzr: ERROR: Not a branch: /home/myusername/.bazaar/
    plugins/lp:bzr-cvsps-import/

Then I think that means your installed version of Bazaar is too old, or at least it did for me. You can remove the old version of Bazaar with an apt-get remove command, and install the new version as described above.

Install cvsps and rcs

cvsps and some commands from RCS are invoked by the cvsps-import plugin, so you’ll need to make sure those two packages are installed:

sudo apt-get install cvsps rcs

Conversion

Create a new directory for exporting your converted CVS modules, say “cvs_to_bzr”. From that directory, start running conversion commands:

bzr cvsps-import /path/to/cvsroot module_name 
    ./converted_module_name

The path to CVSROOT should be the path to the actual repository, not the path to your working directory.

For more information on CVS to BZR conversion, see the CVSPS Import docs on the Bazaar website.