Skip to content

Instantly share code, notes, and snippets.

@jcfr
Last active October 30, 2015 14:02

Revisions

  1. jcfr revised this gist Oct 30, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Slicer-SVN2GitHub-slicerbot.sh
    Original file line number Diff line number Diff line change
    @@ -12,4 +12,4 @@ 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 HEAD && /usr/bin/git svn rebase && /usr/bin/git push $remote master --force) >> $logfile 2>&1
    (/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
  2. jcfr created this gist Oct 19, 2015.
    15 changes: 15 additions & 0 deletions Slicer-SVN2GitHub-slicerbot.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #! /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 HEAD && /usr/bin/git svn rebase && /usr/bin/git push $remote master --force) >> $logfile 2>&1
    9 changes: 9 additions & 0 deletions Slicer-SVN2GitHub.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    #! /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