#!/bin/sh

BASE=$(dirname $0)
cd ${BASE}
BASE=$(pwd)
PROJ=$(basename ${BASE})

echo updating ${BASE}

cvs -d :pserver:anonymous:@cinepaint.cvs.sourceforge.net:/cvsroot/cinepaint login
#cvs -d :pserver:anonymous@cinepaint.cvs.sourceforge.net:/cvsroot/cinepaint checkout cinepaint-project/cinepaint
cvs -d :pserver:anonymous@cinepaint.cvs.sourceforge.net:/cvsroot/cinepaint update cinepaint-project

diff -ruN -x CVS cinepaint-project-0.25.0_p20100330 cinepaint-project | bzip2 > ${PROJ}-diff-`date +%Y%m%d%H%M%S`.patch.bz2

#echo */CVS | tar cjf ${PROJ}-snapshot-`date +%Y%m%d%H%M%S`.tar.bz2 -X - ${PROJ}-project
ln -f -s `ls ${PROJ}-diff-20*.patch.bz2 | sort | tail -n 1` ${PROJ}-diff-latest.patch.bz2

