Skip to content

Instantly share code, notes, and snippets.

@wangmuy
Last active August 30, 2016 02:14
Show Gist options
  • Save wangmuy/54c8b2ffcf2e1f40c88e508ef90c1f2b to your computer and use it in GitHub Desktop.
Save wangmuy/54c8b2ffcf2e1f40c88e508ef90c1f2b to your computer and use it in GitHub Desktop.
svnsync
#!/bin/sh
[ -z "$DIR" ] && DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SRC=http://192.168.1.100/svn
cd $DIR
repo=$1
echo repo=$repo
FILE=file://$DIR/$repo
INIT_OK=0
[ ! -d $repo ] && INIT_OK=1 && mkdir -p $repo && \
svnadmin create $repo && \
REVPROP=$repo/hooks/pre-revprop-change && \
echo '#!/bin/sh' > $REVPROP && \
chmod 755 $REVPROP && \
svnsync -q init $FILE $SRC/$repo && \
INIT_OK=0
[ $INIT_OK -eq 0 ] && [ -d $repo ] && \
svnsync -q --non-interactive --trust-server-cert --source-username git --source-password gitpwd --no-auth-cache sync $FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment