From 50b01e6579047a7819ac12ae7603d47e2246ad7b Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Mon, 18 Aug 2008 17:57:42 +0200 Subject: [PATCH] Support for SVN mirroring --- Girocco/Util.pm | 3 +-- mirroring/clone.sh | 14 +++++++++++++- mirroring/update.sh | 9 ++++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Girocco/Util.pm b/Girocco/Util.pm index 8215695..7040bf1 100644 --- a/Girocco/Util.pm +++ b/Girocco/Util.pm @@ -105,8 +105,7 @@ sub valid_web_url { } sub valid_repo_url { $_ = $_[0]; - /^http:\/\/[a-zA-Z0-9-.]+(\/[_\%a-zA-Z0-9.\/~-]*)?$/ or - /^git:\/\/[a-zA-Z0-9-.]+(\/[_\%a-zA-Z0-9.\/~-]*)?$/; + /^(http|git|svn):\/\/[a-zA-Z0-9-.]+(\/[_\%a-zA-Z0-9.\/~-]*)?$/; } diff --git a/mirroring/clone.sh b/mirroring/clone.sh index f237175..fbc73d4 100755 --- a/mirroring/clone.sh +++ b/mirroring/clone.sh @@ -20,7 +20,19 @@ git config --bool mirror.allowed true # Initial mirror echo "Initiating mirroring..." -git mirror "$url" +case "$url" in + svn://*) + GIT_DIR=. git svn init -s "$url" + GIT_DIR=. git svn fetch + # Neat Trick suggested by Miklos Vajna + GIT_DIR=. git config remote.origin.url . + GIT_DIR=. git config remote.origin.fetch +refs/remotes/heads/*:refs/heads/* + GIT_DIR=. git config remote.origin.fetch +refs/remotes/trunk:refs/heads/master + GIT_DIR=. git config remote.origin.fetch +refs/remotes/tags/*:refs/tags/* + GIT_DIR=. git fetch + ;; + *) git mirror "$url";; +esac # The rest echo "Final touches..." diff --git a/mirroring/update.sh b/mirroring/update.sh index ed683d8..21346aa 100755 --- a/mirroring/update.sh +++ b/mirroring/update.sh @@ -14,7 +14,14 @@ cd "$proj.git" url="$(cat base_url)" mail="$(cat owner)" -bang git mirror "$url" +case "$url" in + svn://*) + GIT_DIR=. bang git svn fetch + GIT_DIR=. bang git fetch + ;; + *) bang git mirror "$url";; +esac + bang git update-server-info date -R >.last_refresh -- 2.11.4.GIT