From 98c2ddf1e9bfa5c3b084ad5e5111e5443fd65d44 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Wed, 12 Jun 2013 12:00:07 +0100 Subject: Add the ability to skip revisions in the mandriva import script. --- scripts/mandriva-svn2git.sh | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/scripts/mandriva-svn2git.sh b/scripts/mandriva-svn2git.sh index fe88d56..1f75bd2 100755 --- a/scripts/mandriva-svn2git.sh +++ b/scripts/mandriva-svn2git.sh @@ -2,13 +2,35 @@ # Reference: written following http://john.albin.net/git/convert-subversion-to-git SOFTWARE=$1 - if [ -z $SOFTWARE ]; then - echo "Missing software to convert..." + echo "Missing software to convert..." + exit 1 +fi +skiprevisions= +skiprevisionsx="$2" +if [ -n "$skiprevisionsx" ]; then + for rev in $skiprevisionsx; do + rev=$(echo $rev | sed 's/r//g') + rev=$(( $rev + 0 )) + if [ $rev -gt 0 ]; then + skiprevisions="$skiprevisions $rev" + fi + done fi # STEP 2: Import in git -git svn clone http://svn.mandriva.com/svn/soft/$SOFTWARE --no-metadata -A authors-transform.txt --stdlayout temp +git svn init http://svn.mandriva.com/svn/soft/$SOFTWARE --no-metadata --stdlayout temp +cd temp +revision=0 +if [ -n "$skiprevisions" ]; then + for rev in $skiprevisions; do + git svn fetch -A ../authors-transform.txt -r $(( $revision + 1 )):$(( $rev - 1 )) + revision=$rev + done +fi +git svn fetch -A ../authors-transform.txt -r $(( $revision + 1 )):HEAD +git reset --hard trunk +cd .. # STEP 3: Convert svn:ignore properties to .git ignore cd temp -- cgit v1.2.1