summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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