Skip to content

Instantly share code, notes, and snippets.

@jcfr
Last active October 30, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcfr/da442a017484b7691018 to your computer and use it in GitHub Desktop.
Save jcfr/da442a017484b7691018 to your computer and use it in GitHub Desktop.
#! /bin/sh
remote=origin
logfile=/Volumes/Dashboards/SVN2Github/Slicer-SVN2GitHub-$remote-lastupdate-log.txt
clonedir=/Volumes/Dashboards/SVN2Github/Slicer-SVN2GitHub
giturl=git@github-slicerbot:Slicer/Slicer.git
svnurl=http://svn.slicer.org/Slicer4/trunk
NOW=$(date +'%T %D')
echo "" > $logfile
echo "$NOW - Updating [$giturl] using [$svnurl]" >> $logfile
echo "HOME: $HOME - USER: $USER - LOGNAME:$LOGNAME - SSH_AGENT_PID:$SSH_AGENT_PID - SSH_AUTH_SOCK:$SSH_AUTH_SOCK" >> $logfile
cd $clonedir
(/usr/bin/git checkout master && /usr/bin/git reset --hard git-svn && /usr/bin/git svn rebase && /usr/bin/git push $remote master --force) >> $logfile 2>&1
#! /bin/sh
# Adapted from http://linuxrhino.blogspot.com/2010/03/follow-up-to-using-passphrase-protected.html
# and http://stackoverflow.com/questions/11546765/how-to-get-the-pid-of-a-process-by-giving-the-process-name-in-mac-os-x
export SSH_AGENT_PID=`ps -A | grep -m1 ssh-agent | awk '{print $1}'`
export SSH_AUTH_SOCK=`find /tmp/ -name 'Listeners' -print 2>/dev/null`
cd /Volumes/Dashboards/SVN2Github
./Slicer-SVN2GitHub-slicerbot.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment