Converting a CVS (or SVN) repository to GNU Arch

Introduction

This document describes a way to convert a CVS repository to the GNU Arch archive format as understood by tla. Since we'll use the Subversion format as an intermediate one, these instructions can be used to convert from SVN to Arch too.

See the page comparing GNU Arch with Subversion and CVS for a (perhaps somewhat skewed) list of reasons why you might want to convert your repositories from CVS/SVN to GNU Arch. Apart from the nice things mentioned about having "Distributed and private repositories" at that page, one aspect of this feature is: it's far more easy to fork a project, while syncing with the official branch regularly. For instance, one could maintain a specific patch for a project during a long time without bearing all the pain traditionally caused by syncing with official releases. This is, imho, the killer feature of distributed version control systems like tla, bzr, git, or darcs over SVN and CVS.

The pro's (and cons) of distributed version control systems are discussed further in this post by Mailman author Barry Warsaw and the resulting thread in May 2007 on the Mailman Developers list.

Choosing tools for conversion, tailor

There are (at least) 3 different Arch-related repository formats (or protocol versions). "tla format": the old-style format understood by tla. "baz format": the (very similar) new-style format understood by tla. "bzr format": the format used by "bzr", from the Bazaar project.

Since tailor cannot create archives in baz format, we won't use that tool.

The conversion leading to this webpage was done in May 2007. If you're reading this after May 2008, there might be other, better tools to tackle the job: Version Control development is very active!

Get the CVS repository

In our example, we'll have the initial CVS repository (the thing containing the ,v-files) in joostvb@nagy:~/cvs-repo/.

Optionally prepare your repository

Before beginning with the conversion, you might like to remove some evil stuff from your repository. For instance, files with UTF-8-like characters in the filename might cause troubles later.

 joostvb@nagy:~% rm cvs-repo/hibou/doc/Attic/lrstable2001073…mail.logml.png,v

Convert from CVS to SVN

We'll use cvs2svn by the Subversion authors, as shipped with the cvs2svn Debian package to convert from CVS to SVN repository format.

 joostvb@nagy:~/work% cvs2svn --encoding=utf8 -s ../svn-repo ../cvs-repo

You can now use the newly created SVN repository:

 joostvb@nagy:~/work% svn co file:///$HOME/logreport/cvs-2-arch-hibou/svn-repo svn-logreport-private

Optionally reshuffle stuff in SVN before converting to Arch

You might like to do some more tweaking on the repository before the final switch to Arch.

 joostvb@nagy:~/work/svn-logreport-private/trunk% svn mv trunk/hibou/doc/foundation trunk/doc/
 joostvb@nagy:~/work/svn-logreport-private/trunk% svn mv trunk/hibou/jobtest trunk/doc/
 joostvb@nagy:~/work/svn-logreport-private/trunk% svn commit -m 'reshuffling the repository: splitting off hibou/'
 Adding         trunk/doc
 Adding         trunk/doc/foundation
 Adding         trunk/doc/jobtest
 Deleting       trunk/hibou/doc/foundation
 Deleting       trunk/hibou/jobtest
 joostvb@nagy:~/work/svn-logreport-private/trunk% svn commit -m 'only needed for CVS'
 Deleting       trunk/CVSROOT

Set up environment for Arch

Create a new empty archive. We are using tla 1.3.5 as shipped with the tla Debian package.

 joostvb@nagy:~% tla make-archive --listing --signed logreport@example.org--2007-logreport-private ~/\{archives\}/2007-logreport-private

Make sure your tla id and default archive are as they should:

 joostvb@nagy:~% tla my-id 'Joost van Baal <joostvb@example.org>'
 joostvb@nagy:~% tla my-default-archive logreport@example.org--2007-logreport-private

Since we'll sign our new archive, we setup gpg-agent.

 joostvb@nagy:~% echo gpg --clearsign --use-agent > ~/.arch-params/signing/=default

See also the Tutorial on Archive Integrity Checking With gnu-arch and the page on gpg configuration for Arch in the GNU Arch Wiki.

 joostvb@nagy:~% export GPG_TTY=`tty`; eval `gpg-agent --daemon`

(you might have to do a "killall gpg-agent" first.)

Convert from SVN to GNU Arch

We are using svn-arch-mirror by Eric Wong, version 0.4.4, to do the conversion to GNU Arch. (For non-Debian-systems, you can download the source (named e.g. svn-arch-mirror_0.4.4.orig.tar.gz) from ftp.debian.org).

 joostvb@nagy:~/work/svn-logreport-private/trunk% svn-arch-mirror --no-my-id-switch init logreport-private--mainline--0.1 > /tmp/log 2>&1

This takes about an hour to complete (well, for my repository on my machine it did).

Use the new Arch repository locally

Now you can use your new arch repository. First check out a working copy:

 joostvb@nagy:~/arch% tla get logreport@example.org--2007-logreport-private/logreport-private--mainline--0.1 logreport-private > /tmp/log2 2>&1
 [...]

and see if everything is there:

 joostvb@nagy:~/arch/logreport-private% tla changelog| less

... or offer it as a shared archive

If you'd like to use it as a shared archive, you can do:

 joostvb@nagy:~/{archives}% tar zcf 2007-logreport-private.tar.gz 2007-logreport-private
 joostvb@nagy:~/{archives}% scp 2007-logreport-private.tar.gz brouwer:

After untarrring on brouwer, you might want to tweak permissions for enabling shared working (see also the page on using a shared archive with GNU Arch.)

 joostvb@brouwer:~logreport/archives% chgrp -R logreport 2007-logreport-private
 joostvb@brouwer:~logreport/archives% chmod -R g+ws,o-rx 2007-logreport-private

Credits

Thanks to Lionel Mamane for giving very useful advice on how to do this conversion.


$Id: converting-cvs-(and-svn)-repository-to-arch.html 1231 2007-08-22 10:07:07Z joostvb $, $URL: svn+ssh://agate.conuropsis.org/home/users/joostvb/srv/svn/www.mdcc.cx/trunk/mdcc.cx/gnu-arch/converting-cvs-(and-svn)-repository-to-arch.html $

Copyright 2007 Joost van Baal, and likely lots of people who've contributed to the The GNU Arch Wiki too.

This document is free; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation.

(Yes, I still should convert the archive _this_ file is in one day...)