Created
January 24, 2013 15:23
-
-
Save loftux/4622983 to your computer and use it in GitHub Desktop.
Revisions
-
loftux created this gist
Jan 24, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ #!/bin/bash # Convert a subversion repository path to git # Author: Peter Löfgren, Loftux AB # The subversion path to export URL="https://share-extras.googlecode.com/svn/trunk/Media Preview" # First revision this path exists STARTREV=2 svn co -r ${STARTREV} "${URL}" export cd "$( dirname "$0" )/export" if [ ! -f ".gitignore" ]; then echo .svn >> .gitignore fi if [ ! -d ".git" ]; then git init git add . git commit -m "Initial commit, export from ${URL}" fi localrev=$(( `svn info | grep Revision | awk '{print $2}'`+1 )) remoterev=$((`svn info $( svn info | grep 'Root:' | awk -F': ' '{print $2}' ) | grep Revision | awk '{print $2}'`+1)) echo Updating from $localrev to $remoterev while [ $localrev -lt $remoterev ]; do echo `date "+%Y-%m-%d %H:%M"` Updating $localrev svn update -q -r $localrev loggmessage=`svn log -r $localrev` git add . git ls-files --deleted | xargs git rm git commit -m "${loggmessage:73}" let localrev=localrev+1 done