#!/bin/bash

# Script to pull an updated version of the grading scripts for this course from
# a Subversion repository onto course-staff available space on AFS.
#
# Optional first argument to script is used for specifying different HOST
# for the transfer

#HOST=addiator.rose-hulman.edu
HOST=sliderule.csse.rose-hulman.edu
#HOST=abacus.csse.rose-hulman.edu
if [ "${1}" != "" ] ; then
	HOST="${1}"
fi

# The directory on the remote host where the checked-out copy of the
# GradingScripts portion of the repository resides.
TARGDIR=/Class/csse/csse230/scripts

# The local subdirectory which corresponds to the scripts portion of the
# repository.
SCRIPTS=`dirname ${0}`/../GradingScripts

if [ -n "`svn st \"${SCRIPTS}\"`" ] ; then
	echo "Uncommitted changes in ${SCRIPTS}"
	echo "Commit changes before publishing"
	exit 1
fi

ssh ${HOST} "svn up \"${TARGDIR}\""