I had been using classic cvs-buildpackage style repository for managing findutils and wanted to switch to subversion. As I am using dpatch and upstream has a public CVS repository I also wanted to only keep the debian-subdirectory under revision control. Failing to find a quick howto I chose to document my steps.
First thing I did was to tar up CVS repository on alioth.
ametzler@haydn:~$ pushd /org/alioth.debian.org/chroot/cvsroot /org/alioth.debian.org/chroot/cvsroot ~ ametzler@haydn:/org/alioth.debian.org/chroot/cvsroot$ tar czpf \ /var/lib/gforge/chroot/home/groups/pkg-findutils/htdocs/pkg-findutils-www/cvsdump.tgz \ pkg-findutils/
I downloaded that to my computer set-up a directory tree for testing and deleted the tarball on alioth
ametzler@downhill:/tmp/$ mkdir /tmp/convert2svn/ ametzler@downhill:/tmp/$ cd /tmp/convert2svn/ ametzler@downhill:/tmp/$ mkdir original cleanedup svn tmp ametzler@downhill:/tmp/convert2svn$ tar -C original/ -xzpf /tmp/cvsdump.tgz
Take a look at the layout of the original repository:
ametzler@downhill:/tmp/convert2svn$ cd tmp/ ametzler@downhill:/tmp/convert2svn/tmp$ ls /tmp/convert2svn/original/pkg-findutils/ CVSROOT findutils ametzler@downhill:/tmp/convert2svn/tmp$ CVSROOT=/tmp/convert2svn/original/pkg-findutils/ \ cvs -Q co findutils ametzler@downhill:/tmp/convert2svn/tmp$ ls findutils ametzler@downhill:/tmp/convert2svn/tmp$ ls findutils/ ABOUT-NLS config.rpath debian install-sh Makefile.in README-alpha aclocal.m4 config.sub depcomp intl missing stamp-h.in AUTHORS configure doc lib mkinstalldirs THANKS ChangeLog configure.in find locate NEWS TODO config.guess COPYING gnulib m4 po xargs config.h.in CVS INSTALL Makefile.am README
As only the debian-subdirectory should live in the new repository, everthing else needed to trashed
ametzler@downhill:/tmp/convert2svn$ tar -C cleanedup/ -xzpf /tmp/cvsdump.tgz ametzler@downhill:/tmp/convert2svn$ cd cleanedup/pkg-findutils/ ametzler@downhill:/tmp/convert2svn/cleanedup/pkg-findutils$ mv findutils/debian/ . ametzler@downhill:/tmp/convert2svn/cleanedup/pkg-findutils$ rm -rf findutils/* ametzler@downhill:/tmp/convert2svn/cleanedup/pkg-findutils$ find findutils/ findutils/ ametzler@downhill:/tmp/convert2svn/cleanedup/pkg-findutils$ mv debian findutils/ ametzler@downhill:/tmp/convert2svn/cleanedup/pkg-findutils$ find findutils/ -maxdepth 1 findutils/ findutils/debian
ametzler@downhill:/tmp/convert2svn$ cvs2svn --fs-type=fsfs \ -s /tmp/convert2svn/svn/pkg-findutils \ /tmp/convert2svn/cleanedup/pkg-findutils/findutils/ \ 2>&1 | tee convert.log
The complete, lengthy output of cvs2svn can be found in convert.log. The resulting new repository looks like this:
ametzler@downhill:/tmp/convert2svn$ svn list file:///tmp/convert2svn/svn/ svn: Unable to open an ra_local session to URL svn: Unable to open repository 'file:///tmp/convert2svn/svn' ametzler@downhill:/tmp/convert2svn$ svn list file:///tmp/convert2svn/svn/pkg-findutils/ branches/ tags/ trunk/ ametzler@downhill:/tmp/convert2svn$ svn list \ file:///tmp/convert2svn/svn/pkg-findutils/trunk debian/ ametzler@downhill:/tmp/convert2svn$ svn list \ file:///tmp/convert2svn/svn/pkg-findutils/branches Branch_post_4_1_20-4/ source-dist/ ametzler@downhill:/tmp/convert2svn$ svn list \ file:///tmp/convert2svn/svn/pkg-findutils/branches/Branch_post_4_1_20-4/ debian/ ametzler@downhill:/tmp/convert2svn$ svn list file:///tmp/convert2svn/svn/pkg-findutils/tags | head -n 3 debian_version_4_1_20-1/ debian_version_4_1_20-2/ debian_version_4_1_20-3/
Now some more cleaning was necessary, first branches/source-dist/ nneds to. It existed because some upstream I checked in (probably a CVS-dump) contained a debian directory.
ametzler@downhill:/tmp/convert2svn$ svn -m'remove branches/source-dist' \ delete file:///tmp/convert2svn/svn/pkg-findutils/branches/source-dist/ ametzler@downhill:/tmp/convert2svn$ svn -m'remove tags/upstream_version_4_2_3_20041106' \ delete file:///tmp/convert2svn/svn/pkg-findutils/tags/upstream_version_4 _2_3_20041106/
svn has no problems with dots in tagnames, therefore svn-buildpackage can use literal dots.
ametzler@downhill:/tmp/convert2svn$ svn ls file:///tmp/convert2svn/svn/pkg-findutils/tags \| head -n 3 debian_version_4_1_20-1/ debian_version_4_1_20-2/ debian_version_4_1_20-3/ ametzler@downhill:/tmp/convert2svn$ repo='file:///tmp/convert2svn/svn/pkg-findutils/tags';\ for i in `svn ls $repo` ; \ do tag=`echo $i | sed -e 's_/.*__'`;\ newtag=`echo $tag | sed -e 's/debian_version_//' -e 's/_/./g'`;\ svn -m"renaming $tag to $newtag" mv "${repo}/$tag" "${repo}/$newtag";\ done
The tags corresponding to new upstream do not serve a real purpose.
ametzler@downhill:/tmp/$ repo='file:///tmp/convert2svn/svn/pkg-findutils/tags';\ for i in `svn ls $repo| grep -v -- -` ;\ do tag=`echo $i | sed -e 's_/.*__'`;\ svn -m"removing non-upload tag $tag" delete "${repo}/$tag";\ done
Generate a portable dump and transfer it to svn.debian.org
ametzler@downhill:/tmp$ svnadmin dump /tmp/convert2svn/svn/pkg-findutils |\ bzip2 > /tmp/dump.bz2 ametzler@downhill:/tmp$ scp /tmp/dump.bz2 svn.debian.org:
(svn.debian.org uses the same ssh-key as alioth does, not the one for regular debian machines!). Now the repository needed only to be fed to svnadmin.
ametzler@costa:~$ bzcat dump.bz2 | svnadmin load /svn/pkg-findutils