diff options
author | Colin Guthrie <colin@mageia.org> | 2013-08-20 00:11:03 +0100 |
---|---|---|
committer | Colin Guthrie <colin@mageia.org> | 2013-08-20 00:40:57 +0100 |
commit | 518b3dd93ce12fd760fbc2b4a88ea1c6654af5a6 (patch) | |
tree | 642a664dcda388df6b650e725c061b46eb84007b | |
parent | 3199d029c027b25bed58813f3a3604f581546318 (diff) | |
download | svn-git-migration-518b3dd93ce12fd760fbc2b4a88ea1c6654af5a6.tar svn-git-migration-518b3dd93ce12fd760fbc2b4a88ea1c6654af5a6.tar.gz svn-git-migration-518b3dd93ce12fd760fbc2b4a88ea1c6654af5a6.tar.bz2 svn-git-migration-518b3dd93ce12fd760fbc2b4a88ea1c6654af5a6.tar.xz svn-git-migration-518b3dd93ce12fd760fbc2b4a88ea1c6654af5a6.zip |
Allow renaming of svn path in mageia
-rwxr-xr-x | scripts/mageia-reset-and-import.sh | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/scripts/mageia-reset-and-import.sh b/scripts/mageia-reset-and-import.sh index 56f1b97..e4bf524 100755 --- a/scripts/mageia-reset-and-import.sh +++ b/scripts/mageia-reset-and-import.sh @@ -5,8 +5,12 @@ SOFTWARE= if [ -d ".git" -a -f ".git/config" -a -f ".git/svn/.metadata" ]; then SOFTWARE=$(git config svn-remote.svn.fetch | cut -d':' -f1 | sed 's,/trunk,,' | trim) fi +NEWSOFTWARE=$SOFTWARE +if [ -n "$1" ]; then + NEWSOFTWARE=$1 +fi echo -echo "Identified software name: $SOFTWARE" +echo "Identified software name: $SOFTWARE (New name: $NEWSOFTWARE)" if [ -z "$SOFTWARE" ]; then echo "You must run this in a git-svn clone folder." >&2 @@ -67,6 +71,9 @@ echo $NEWSVNUUID echo -n "Updating SVN Remote config (old value: $(git config svn-remote.svn.url))... " git config svn-remote.svn.url $NEWSVNURL +git config svn-remote.svn.fetch "$NEWSOFTWARE/trunk:refs/remotes/trunk" +git config svn-remote.svn.branches "$NEWSOFTWARE/branches/*:refs/remotes/*" +git config svn-remote.svn.tags "$NEWSOFTWARE/tags/*:refs/remotes/tags/*" echo "done" echo -n "Updating Internal SVN metadata... " @@ -149,7 +156,7 @@ if [ -z "$REPLAY" ]; then echo "Press any key to contiue." read -n 1 - svn log $NEWSVNURL/$SOFTWARE | less + svn log $NEWSVNURL/$NEWSOFTWARE | less echo echo "OK you're back :)" @@ -219,7 +226,7 @@ SVNPATH=$(realpath ../$SOFTWARE.svn) rm -rf $SVNPATH mkdir -p $SVNPATH/export cd $SVNPATH/export -svn export --force --ignore-keywords --ignore-externals -r $revision $NEWSVNURL/$SOFTWARE/trunk . +svn export --force --ignore-keywords --ignore-externals -r $revision $NEWSVNURL/$NEWSOFTWARE/trunk . cd - svnadmin create $SVNPATH/repo svnrepo=file://$SVNPATH/repo @@ -228,7 +235,7 @@ svn checkout $svnrepo $SVNPATH/checkout cd $SVNPATH/checkout if [ -n "$morerevisions" ]; then for rev in $morerevisions; do - svn merge -c $rev --ignore-ancestry --accept theirs-full --allow-mixed-revisions $NEWSVNURL/$SOFTWARE/trunk . + svn merge -c $rev --ignore-ancestry --accept theirs-full --allow-mixed-revisions $NEWSVNURL/$NEWSOFTWARE/trunk . svn commit -m "Merged r$rev" if [ $? -ne 0 ]; then echo @@ -258,20 +265,20 @@ Synthesized commit during git-svn import combining previous Mandriva history wit This commit consitsts of the following subversion commits: EOF -svn log -r 1:$revision $NEWSVNURL/$SOFTWARE/trunk >>$COMMITTXT -squashedrevs=$(svn log -r 1:$revision $NEWSVNURL/$SOFTWARE/trunk | grep -E "^r[0-9]+ \| " | cut -d' ' -f1 | xargs | sed 's/r//g') +svn log -r 1:$revision $NEWSVNURL/$NEWSOFTWARE/trunk >>$COMMITTXT +squashedrevs=$(svn log -r 1:$revision $NEWSVNURL/$NEWSOFTWARE/trunk | grep -E "^r[0-9]+ \| " | cut -d' ' -f1 | xargs | sed 's/r//g') rev=0 if [ -n "$morerevisions" ]; then for rev in $morerevisions; do - svn log -r $rev $NEWSVNURL/$SOFTWARE | tail -n +2 >>$COMMITTXT + svn log -r $rev $NEWSVNURL/$NEWSOFTWARE | tail -n +2 >>$COMMITTXT done fi # Import any documentation from the CLEANUP_PROGRESS.txt file [ "$rev" = "0" ] && rev=$revision CLEANUP_PROGRESS=$(mktemp /tmp/cleanupprogress.XXXXXX) -svn cat $NEWSVNURL/$SOFTWARE/CLEANUP_PROGRESS.txt@$rev 2>/dev/null >$CLEANUP_PROGRESS +svn cat $NEWSVNURL/$NEWSOFTWARE/CLEANUP_PROGRESS.txt@$rev 2>/dev/null >$CLEANUP_PROGRESS if [ -s $CLEANUP_PROGRESS ]; then echo >>$COMMITTXT echo "In addition to the above commits, the following cleaning work has been recorded:" >>$COMMITTXT @@ -280,7 +287,7 @@ if [ -s $CLEANUP_PROGRESS ]; then fi rm -f $CLEANUP_PROGRESS -COMMITDATE=$(svn log -r $revision $NEWSVNURL/$SOFTWARE | head -n2 | tail -n1 | cut -d'|' -f3 | cut -d'(' -f1 | trim) +COMMITDATE=$(svn log -r $revision $NEWSVNURL/$NEWSOFTWARE | head -n2 | tail -n1 | cut -d'|' -f3 | cut -d'(' -f1 | trim) env GIT_COMMITTER_NAME="Mageia SVN-Git Migration" \ GIT_COMMITTER_EMAIL="svn-git-migration@mageia.org" \ GIT_COMMITTER_DATE="$COMMITDATE" \ |