Since I do this a lot of time, I've create two scripts: svkpull and svkpush that updates my local branch from the main branch and push my changes to the main branch.
svkpull
#!/bin/bash
# Get changes from mirrord subversion repository
# Miki Tebeka
case $# in
0 ) up=1; project=`basename $PWD`;;
1 ) up=0; project=$1;;
* ) echo "usage: `basename $0` [PROJECT_NAME]"; exit 1;;
esac
echo "Project is $project"
svk info //$project > /dev/null
if [ $? -ne 0 ]; then
echo "error: bad project - $project"
exit 1
fi
svk sync //$project/mirror
if [ $? -ne 0 ]; then
exit $?
fi
svk smerge --incremental -l //$project/mirror //$project/local
if [ $? -ne 0 ]; then
exit $?
fi
if [ $up == 1 ]; then
svk up
extra=""
else
extra="Don't forget to run 'svk up'"
fi
echo
echo "Done. $extra"
svkpush
#!/bin/bashNotes:
# Push changes to mirrord subversion repository
# Miki Tebeka
USAGE="usage: `basename $0` [-m comment] [PROJECT]"
COMMENT=""
while getopts "m:h" opt
do
case $opt in
m ) COMMENT=$OPTARG;;
h ) echo $USAGE; exit;;
* ) echo "error: unrecognized option -$opt"; exit 1;;
esac
done
shift $(($OPTIND - 1))
case $# in
0 ) up=1; project=`basename $PWD`;;
1 ) up=0; project=$1;;
* ) echo $USAGE; exit 1;;
esac
echo "Project is $project"
svk info //$project > /dev/null
if [ $? -ne 0 ]; then
echo "error: bad project - $project"
exit 1
fi
svk sync //$project/mirror
if [ $? -ne 0 ]; then
exit $?
fi
if [ "$COMMENT" == "" ]; then
svk smerge //$project/local //$project/mirror
else
svk smerge -m "$COMMENT" //$project/local //$project/mirror
fi
if [ $? -ne 0 ]; then
exit $?
fi
echo
echo "Done."
- If project is X the mirror is in //X/mirror and local branch is in //X/local
- I use svk smerge --incremental -l only when getting changes