#!/bin/bash


# Check out the tags. 
# I find the tags from git for simplicity.
rm -f *log

rm -rf cvs-co
mkdir cvs-co
cd cvs-co
(cd ../pgjdbc-non-bare && git tag -l ) | while read foo ; do cvs co -r "$foo" -d "${foo}" pgjdbc >>../cvs_co.log 2>&1; done 


# Verify that the tags are correct.
cd ../pgjdbc-non-bare
git tag -l |while read foo ; do 
	(git checkout $foo >>../git-co.log 2>&1)  
	diff -r --exclude=CVS --exclude=.git . ../cvs-co/${foo} \
			|grep "\$Header:" -v \
			|egrep -v "^\-\-\-$"  \
			|egrep -v "^[0-9]+c[0-9]+" \
			|grep -v "^diff \-r '\-\-exclude" >>../diff.log
done

if [ -s "../diff.log" ] ; then
	echo "There is differences."
	exit 1
fi

if [ ! -s "../git-co.log" ] ; then
	echo "Problems with git checkout"
	exit 1
fi


