diff options
-rwxr-xr-x | scripts/mageia-reset-and-import.sh | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/scripts/mageia-reset-and-import.sh b/scripts/mageia-reset-and-import.sh index fd74a61..b24abe5 100755 --- a/scripts/mageia-reset-and-import.sh +++ b/scripts/mageia-reset-and-import.sh @@ -25,7 +25,8 @@ if [ -f ../svn-import.log ]; then resetsha1=$(echo $REPLAYDATA | cut -d',' -f 2) revision=$(echo $REPLAYDATA | cut -d',' -f 3) morerevisionsx=$(echo $REPLAYDATA | cut -d',' -f 4) - synthesized=$(echo $REPLAYDATA | cut -d',' -f 5) + skiprevisionsx=$(echo $REPLAYDATA | cut -d',' -f 5) + synthesized=$(echo $REPLAYDATA | cut -d',' -f 6) echo echo "I have found data from a previous run:" @@ -33,6 +34,7 @@ if [ -f ../svn-import.log ]; then echo "Reset SHA1: $resetsha1" echo "Mageia Import SVN Revision: $revision" echo "Extra SVN Revisions to squash:$morerevisionsx" + echo "SVN Revisions to skip: $skiprevisionsx" echo echo "Do you want to reply it? [Y/n]" read REPLAY @@ -140,6 +142,26 @@ if [ -n "$morerevisionsx" ]; then echo " $morerevisions" echo fi + +if [ -z "$REPLAY" ]; then + echo "Now enter any commits you wish to skip completely (e.g. for commits+reverts)" + read skiprevisionsx +fi +skiprevisionsx=$(echo $skiprevisionsx | trim) +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 + echo + echo "OK, you said you wanted to skip the following commits:" + echo " $skiprevisions" + echo +fi + echo echo "The next step is the dangerous bit. We will clear out all files in the current" echo "working copy, run an svn export and then drop you to a shell to investigate the differences" @@ -206,7 +228,7 @@ if [ -n "$morerevisions" ]; then done fi -COMMITDATE=$(svn log -r $revision $NEWSVNURL/$SOFTWARE | head -n2 | tail -n1| cut -d'|' -f3 | cut -d'(' -f1 | trim) +COMMITDATE=$(svn log -r $revision $NEWSVNURL/$SOFTWARE | head -n2 | tail -n1 | cut -d'|' -f3 | cut -d'(' -f1 | trim) git commit --author="Mageia SVN-Git Migration <svn-git-migration@mageia.org>" --date="$COMMITDATE" --file=$COMMITTXT -a rm -f $COMMITTXT @@ -229,9 +251,9 @@ echo "done" # Keep a small log of the sha1's etc. if [ -z "$REPLAY" ]; then if [ ! -f ../svn-import.log ]; then - echo "software,startingcommit,startingrevision,otherrevisions,fakecommit" >../svn-import.log + echo "software,startingcommit,startingrevision,otherrevisions,skiprevisions,fakecommit" >../svn-import.log fi - echo "$SOFTWARE,$resetsha1,$revision,$morerevisions,$sha1" >>../svn-import.log + echo "$SOFTWARE,$resetsha1,$revision,$morerevisions,$skiprevisions,$sha1" >>../svn-import.log else sed -i "s/,$synthesized\$/,$sha1/" ../svn-import.log fi @@ -243,6 +265,16 @@ if [ -n "$morerevisions" ]; then revision=$rev done fi + +# Note the revisions to skip have to be after any squashed revisions which we +# should really check for.... +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 echo |