Tollef Fog Heen's blog

tfheen Tue, 09 Mar 2004 - sync-dotfiles-repos

By popular demand, I'm just including my sync-dotfiles-repost, aka svn2cvs script here. I hope it's useful for somebody, and comments and patches are appreciated.

 #! /bin/sh -e

 #exec > /tmp/commit.log  2>&1 

 HOME=/home/tfheen
 CVSROOT="$HOME/cvsroot"
 SVNROOT="$HOME/svn"

 TMPDIR=$(tempfile --prefix syncdotfiles)

 rm -f "$TMPDIR"
 mkdir $TMPDIR
 cd $TMPDIR

 # ok, now we are fairly safe.

 cvs -d "$CVSROOT" co dotfiles
 svn export --force file://$SVNROOT/trunk/dotfiles

 cd dotfiles

 for file in $(find -type f -not -path \*CVS\*); do
     FILE=$(basename $file)
     DIR=$(dirname $file)
     if ! grep -q "^/$FILE/" $DIR/CVS/Entries ; then 
         cvs add $file
     fi
 done

 cvs commit -m"Automatic commit from SVN"

 rm -rf $TMPDIR
[09:41] | tech | sync-dotfiles-repos

Tollef Fog Heen <tfheen@err.no>