Skip to content

Instantly share code, notes, and snippets.

@eedgar
Created July 19, 2013 15:16
Show Gist options
  • Save eedgar/6039856 to your computer and use it in GitHub Desktop.
Save eedgar/6039856 to your computer and use it in GitHub Desktop.
Example script to backport from github to 4.2.x ... requires git, svn, and git-svn
ZP_NAME="ZenPacks.zenoss.NetAppMonitor"
SVN_REPO="svn+ssh://eedgar@i7/home/eedgar/svn_git_tests/dummysvnrepo"
SVN_BRANCH="branches/zenoss-4.x/zenpacks/$ZP_NAME"
GIT_REPO="/home/eedgar/svn_git_tests/git_master/$ZP_NAME"
LAST_SVN_COMMIT=$(svn info $SVN_REPO/$SVN_BRANCH|grep "Last Changed Rev:"|awk -F ': ' '{print $2}')
rm -rf $ZP_NAME
mkdir $ZP_NAME
cd $ZP_NAME
git init
git svn init $SVN_REPO/$SVN_BRANCH
git svn fetch -r $LAST_SVN_COMMIT
git repack -d
git remote add upstream $GIT_REPO
git fetch upstream
git checkout -b svn git-svn
git merge --no-commit --squash upstream/master
echo
echo "Printing SVN LOG"
svn log $SVN_REPO/$SVN_BRANCH
#git svn dcommit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment