Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support mirroring repos that don't have trunk folder

  • Loading branch information...
commit 09602c708206ab21de7242886061d901fff49038 1 parent 39c3fc1
git authored
Showing with 23 additions and 3 deletions.
  1. +23 −3 mirror-svn-git
View
26 mirror-svn-git
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+#!/bin/bash
# Script to mirror an SVN project in git.
svn_url=$1
@@ -13,6 +13,17 @@ else
basename_prefix="$2"
fi
+#Make sure we have a trailing / on he URL
+[[ $svn_url != */ ]] && 1="$svn_url"/
+
+# Check if it looks like a standard repo
+svn ls $svn_url > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+ echo Does not appear to be a svn repository $svn_url
+ exit 1
+fi
+
+
gitsvn_basename="${basename_prefix}.git-svn"
git_basename="${basename_prefix}.git"
@@ -33,8 +44,17 @@ if [ -d $git_basename ]; then
exit 1
fi
-# Should check it's standard layout if git doesn't and bail
-git svn clone -s $1 ${gitsvn_basename}-new
+svn ls ${svn_url}trunk > /dev/null 2>&1
+if [ $? -eq 0 ]; then
+ opts="-s"
+fi
+
+
+# Now bail if anything fails
+set -e
+
+git svn clone $opts $svn_url ${gitsvn_basename}-new
+
mv ${gitsvn_basename}-new $gitsvn_basename
pushd $gitsvn_basename
src_url=$(git config --get svn-remote.svn.url)
Please sign in to comment.
Something went wrong with that request. Please try again.