Skip to content

Instantly share code, notes, and snippets.

@jbalogh
Created January 22, 2010 19:07
Show Gist options
  • Select an option

  • Save jbalogh/284042 to your computer and use it in GitHub Desktop.

Select an option

Save jbalogh/284042 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Export our git tree to svn for eternal IT love and happiness.
ROOT=$(pwd)/svn-wankery
GIT_REPO='git://github.com/jbalogh/zamboni.git'
SVN_REPO='https://svn.mozilla.org/projects/zamboni'
SVN=$ROOT/svn-z
GIT=$ROOT/git-z
mkdir -p $ROOT
cd $ROOT
# Make sure our repos are checked out.
if [[ ! -d $SVN ]]; then
git svn clone $SVN_REPO $SVN
fi
if [[ ! -d $GIT ]]; then
git clone $GIT_REPO $GIT
fi
# Update svn.
cd $SVN
git svn rebase
# Update git.
cd $GIT
git pull
git submodule update --init
GIT_REV=$(git rev-parse HEAD)
# Move everything from git to svn.
rsync -avC --delete --exclude .git $GIT/ $SVN/
# Update and commit to upstream.
cd $SVN
git add .
git commit -m "Export from $GIT_REPO @ $GIT_REV"
git svn dcommit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment