#!/bin/bash -e

# adjust these variables...
SVN_DIR='XXX'
SVN_USER='XXX'
SVN_PASS='XXX'

# ---------------------------------------- begin generic sync script

REV=`svn info $SVN_DIR | sed -ne 's/^Revision: //p'`
CHANGES=`svn log --trust-server-cert --non-interactive --username $SVN_USER --password $SVN_PASS -r $(($REV+1)):HEAD --incremental $SVN_DIR 2>/dev/null` || exit 0

if [ "$CHANGES" == "" ]; then exit 0; fi

URL=`svn info $SVN_DIR | grep URL:`

echo "$URL: (from r$REV)"
echo "$CHANGES"
echo "------------------------------------------------------------------------"

svn up --quiet --trust-server-cert --non-interactive --username $SVN_USER --password $SVN_PASS $SVN_DIR

# ---------------------------------------- end generic sync script (anything after this is only executed in case of sync)
