From fca82126ffd1529b3e99863da562f86a5f8723d9 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 4 Jan 2010 13:07:18 +0100 Subject: Add script to sync git repos to subversion repos Based on http://google-opensource.blogspot.com/2008/05/export-git-project-to-google-code.html --- git2svn-sync | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 git2svn-sync diff --git a/git2svn-sync b/git2svn-sync new file mode 100755 index 0000000..dbb4fc4 --- /dev/null +++ b/git2svn-sync @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Sync git repository to subversion repository. +# +# Based on http://google-opensource.blogspot.com/2008/05/export-git-project-to-google-code.html + +if [ $# -lt 2 ] ; then + echo "usage: ${0} GIT_REPO GIT_SVN_REPO_CHECKOUT" + exit 2 +fi + +GIT_REPO=$1 +GIT_SVN_REPO_CHECKOUT=$2 + +if [ ! -d $GIT_SVN_REPO_CHECKOUT/.git/svn ] ; then + echo "error: no git-svn checkout found in $GIT_SVN_REPO_CHECKOUT" + exit 3 +fi + +export GIT_DIR=$GIT_SVN_REPO_CHECKOUT +git fetch $GIT_REPO +git branch tmp $(cut -b-40 .git/FETCH_HEAD) +git tag -a -m "Last fetch" newlast tmp +git rebase --onto master last tmp +git branch -M tmp master +git svn dcommit +mv $GIT_SVN_REPO_CHECKOUT/.git/refs/newlast \ + $GIT_SVN_REPO_CHECKOUT/.git/refs/last + +# vim:ft=sh -- cgit v1.2.3-54-g00ecf