Tracking cvs trunk with svn

I recently had the need to track a cvs repository in an svn repository (for simple patch creation, etc). Nothing in this is particular to cvs, and it could be used to maintain a seperate repository of svn as well (although the externals interface would probably work much better there).

Improvements/Errors

 * Add log conversion from cvs to svn
 * Change things such that we don't need a second copy of the archive
 * This script, as written, assumes you have quite a bit of space.
 * Various extra steps could probably be deleted under Setup
 * Fix the fact that if any new files in our archive contain spaces, bash/awk chokes on them

Setup

 * 1) Setup a directory to manage this stuff.
 * 2) Pick a date to do your initial checkout (let's say a week ago)
 * 3) ;date +%F >> update_date
 * 4) Use cvs co to checkout your trunk repository on some date in the past (about a week ago)
 * 5) ;Just for fun let's say it's cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/glibc co -D"`cat update_date` 00:00:00 GMT" -P libc
 * 6) Make an ignore file so that we don't mess up the versioning information
 * 7) ; echo -e "CVS\n.svn">rsync_ignore_file
 * 8) Make a directory for our svn version mkdir svn_version_name
 * 9) Use rsync to copy the data
 * 10) ;rsync -ruv --exclude-from=./rsync_ignore_file libc/* svn_version_name/
 * 11) Add it to your svn archive
 * 12) ;svn import svn_version_name file:///home/svn/repository/glibc/branches/my_branch/svn_version_name
 * 13) Delete the directory, and check it out from svn again
 * 14) ; rm -rf svn_version_name && svn co file:///home/svn/repository/glibc/branches/my_branch/svn_version_name
 * 15) Copy and modify the following script to your repositorise
 * 16) Run the script once to verify that it works
 * 17) Set that early line in the script to update_date=`date +%F`
 * 18) Setup a cron job to call the below script (remember to add paths for the utilities)

The Script
Set the update_date below to be one day later than originally planned, but you can see that the script is fairly simple. There are almost certainly cases that it will not handle, but it seems to work well enough.
 * 1) !/bin/bash

update_date=SET THIS TO ONE DAY LATER AT FIRST

date_file="/home/svn/glibc-trunk/last_update" last_update=`cat $date_file`

echo $update_date > $date_file

cd /home/svn/glibc-trunk/libc cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/glibc up -D"$update_date 00:00:00 GMT" -P
 * 1) update the cvs

/usr/bin/rsync -rv --delete --exclude-from=/home/svn/glibc-trunk/rsync_ignore_file /home/svn/glibc-trunk/libc/ /home/svn/glibc-trunk/glibc/
 * 1) Copy from cvs to svn (ignoring CVS and .svn directories)

cd /home/svn/glibc-trunk/glibc
 * 1) Process output of svn status

for arg in $( svn st | awk '$1 == "!" {print $2}' ); do       svn del $arg done

for arg in $( svn st | awk '$1 == "?" {print $2}' ); do       svn add $arg done

svn ci -m "Regularly scheduled glibc-trunk cvs sync for date $update_date" svn up