summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2013-08-20 11:00:41 +0100
committerColin Guthrie <colin@mageia.org>2013-08-20 11:00:41 +0100
commit72f65363bdd413958aeaad4e3b86ba3da49c5688 (patch)
treebcc36a5e0f235867fdbb9a4af45a75d22cc616fa /scripts
parentdb565f2335c2d8b2791215579dc616bc771acc49 (diff)
downloadsvn-git-migration-72f65363bdd413958aeaad4e3b86ba3da49c5688.tar
svn-git-migration-72f65363bdd413958aeaad4e3b86ba3da49c5688.tar.gz
svn-git-migration-72f65363bdd413958aeaad4e3b86ba3da49c5688.tar.bz2
svn-git-migration-72f65363bdd413958aeaad4e3b86ba3da49c5688.tar.xz
svn-git-migration-72f65363bdd413958aeaad4e3b86ba3da49c5688.zip
Detect standard layout and make sure to delete git-svn branch after conversion
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mageia-import.sh22
1 files changed, 17 insertions, 5 deletions
diff --git a/scripts/mageia-import.sh b/scripts/mageia-import.sh
index 1206b79..09404c3 100755
--- a/scripts/mageia-import.sh
+++ b/scripts/mageia-import.sh
@@ -42,7 +42,12 @@ echo "Identified software name: $SOFTWARE"
echo "SVN Revisions to skip: $skiprevisions"
echo
-git svn init $NEWSVNURL/$SOFTWARE --no-metadata --stdlayout $BASESOFTWARE-origin
+STDLAYOUT=--stdlayout
+if [ "$(svn ls $NEWSVNURL/$SOFTWARE/trunk 2>/dev/null | wc -l)" == "0" ]; then
+ STDLAYOUT=
+fi
+
+git svn init $NEWSVNURL/$SOFTWARE --no-metadata $STDLAYOUT $BASESOFTWARE-origin
cd $BASESOFTWARE-origin
revision=0
if [ -n "$skiprevisions" ]; then
@@ -52,7 +57,9 @@ if [ -n "$skiprevisions" ]; then
done
fi
git svn fetch -A $AUTHORMAP -r $(( $revision + 1 )):HEAD
-git reset --hard trunk
+if [ -n "$STDLAYOUT" ]; then
+ git reset --hard trunk
+fi
echo
echo "done"
@@ -66,7 +73,8 @@ git remote add origin ../$BASESOFTWARE.git
git push origin master 'refs/remotes/*:refs/heads/*'
pushd ../$BASESOFTWARE.git
-git branch -D trunk
+git branch -D trunk 2>/dev/null
+git branch -D git-svn 2>/dev/null
git branch -D origin/master 2>/dev/null
# Tagging logic inspired by https://github.com/nothingmuch/git-svn-abandon/blob/master/git-svn-abandon-fix-refs
@@ -210,7 +218,11 @@ sql="../$BASESOFTWARE-revmap.sql"
rm -f "$sql" "$sql".xz
# Mageia commits
-revmap=".git/svn/refs/remotes/trunk/.rev_map.$NEWSVNUUID"
+TRUNKNAME=trunk
+if [ -z "$STDLAYOUT" ]; then
+ TRUNKNAME=git-svn
+fi
+revmap=".git/svn/refs/remotes/$TRUNKNAME/.rev_map.$NEWSVNUUID"
if [ -f "$revmap" ]; then
parsesvnrevmap "$revmap" "mga" "" $fakesha1 >>"$sql"
fi
@@ -218,7 +230,7 @@ for revmap in $(find .git/svn/refs/remotes/tags -name .rev_map.$NEWSVNUUID 2>/de
# Note, still pass in the tag name in case the tag is really more of a branch...
parsesvnrevmap "$revmap" "mga" "$(echo $revmap | cut -d'/' -f6)" >>"$sql"
done
-for revmap in $(find .git/svn/refs/remotes -maxdepth 2 -not -iwholename ".git/svn/refs/remotes/trunk/.rev_map.*" -name .rev_map.$NEWSVNUUID 2>/dev/null); do
+for revmap in $(find .git/svn/refs/remotes -maxdepth 2 -not -iwholename ".git/svn/refs/remotes/$TRUNKNAME/.rev_map.*" -name .rev_map.$NEWSVNUUID 2>/dev/null); do
parsesvnrevmap "$revmap" "mga" "$(echo $revmap | cut -d'/' -f5)" >>"$sql"
done