[gnome-git-migration] Update importer to handle sub-repo svn repos (gnomemm, seahorse)



commit dc6a6fb48bfef6795ab4e0393a5a5b59795c12d1
Author: Kristian Høgsberg <krh redhat com>
Date:   Mon Mar 30 17:49:52 2009 -0400

    Update importer to handle sub-repo svn repos (gnomemm, seahorse)
---
 import/fixup.sh      |    2 +-
 import/run-import.sh |  167 +++++++++++++++++++++++++++++++++----------------
 2 files changed, 113 insertions(+), 56 deletions(-)

diff --git a/import/fixup.sh b/import/fixup.sh
index 1114421..25955a3 100755
--- a/import/fixup.sh
+++ b/import/fixup.sh
@@ -43,6 +43,6 @@ EOF
     esac
 done
 
-git filter-branch -f --commit-filter ${PWD}'/gnome-edit-changelog $$@' --tag-name-filter cat -- --all
+git filter-branch -f --commit-filter ${PWD}'/gnome-edit-changelog $@' --tag-name-filter cat -- --all
 
 git repack -a -d -f --window=50 --depth=20
diff --git a/import/run-import.sh b/import/run-import.sh
index e685a53..5626c82 100755
--- a/import/run-import.sh
+++ b/import/run-import.sh
@@ -13,51 +13,114 @@ svn_repos=/mnt/git-data/svn
 fast_export=/home/users/krh/svn-all-fast-export/svn-all-fast-export
 parsecvs=/home/users/krh/parsecvs/parsecvs
 
-function run_parsecvs () {
-    find $cvs_repos/$cvs_repo -name '*,v' | $parsecvs
-}
+function write_submodule_config () {
+    r=${1/\//-}
+    cat <<EOF
+create repository $r
+end repository
 
-function run_fast_export () {
-    # Now run svn-all-fast-export toa add the svn history on top
+match ^/$1/branches/([^/+]+)/
+repository $r
+branch \1
+end match
+
+match ^/$1/branches/([^/+]+)
+repository $r
+branch \1
+end match
+
+match ^/$1/branches/
+action recurse
+end match
+
+match ^/$1/tags/([^/+]+)/
+repository $r
+branch refs/tags/\1
+end match
+
+match ^/$1/tags/([^/+]+)
+repository $r
+branch refs/tags/\1
+end match
+
+match ^/$1/tags/
+action recurse
+end match
+
+match ^/$1/trunk/
+repository $r
+branch master
+end match
+
+match ^/$1/trunk
+repository $r
+branch master
+end match
+
+match ^/$1/$
+action recurse
+end match
+
+match ^/$1$
+action ignore
+end match
 
-    cat <<EOF > config
+EOF
+}
+
+function write_config () {
+    cat <<EOF
 create repository $repo
 
 end repository
 
-match /branches/([^/+]+)/
+match ^/branches/([^/+]+)/
 repository $repo
 branch \1
 end match
 
-match /branches/([^/+]+)
+match ^/branches/([^/+]+)
 repository $repo
 branch \1
 end match
 
-match /tags/([^/+]+)/
+match ^/tags/([^/+]+)/
 repository $repo
 branch refs/tags/\1
 end match
 
-match /tags/([^/+]+)
+match ^/tags/([^/+]+)
 repository $repo
 branch refs/tags/\1
 end match
 
-match /trunk/
+match ^/trunk/
 repository $repo
 branch master
 end match
 
-match /trunk
+match ^/trunk
 repository $repo
 branch master
 end match
 
-$seahorse_plugins
+match ^/(libbonobomm|libbonobouimm|libgnomeprintmm|libgnomeprintuimm)
+replace /deprecated/\1
+end match
+
+match ^/deprecated
+action ignore
+end match
+
+EOF
+
+    for m in $@; do
+	write_submodule_config $m
+    done
 
-match ^/(temp|banshee|desktop|bigboard|dumbhippo)
+    cat <<EOF 
+
+match ^/(temp|banshee|desktop|bigboard|dumbhippo|plugins)
 replace /trunk/git-migration-\1
 end match
 
@@ -75,6 +138,10 @@ replace /tags/git-migration-\1
 end match
 
 EOF
+}
+
+function run_fast_export () {
+    write_config $@ > config
 
     if [ -d $cvs_repos/$cvs_repo ]; then
 	start=$(svn info file://$svn_repos/$repo -r {2006-12-30}  | sed -ne 's/^Revision: //p')
@@ -82,72 +149,62 @@ EOF
 	resume="-resume-from $start"
     fi
 
-    echo $fast_export -identity-map gnome-all-usermap config $svn_repos/$repo
+    echo $fast_export $resume -identity-map gnome-all-usermap config $svn_repos/$repo
 
     $fast_export $resume -identity-map gnome-all-usermap config $svn_repos/$repo
 }
 
-
 # Log everthing to this file
 exec > $repo-import.log 2>&1
 
-export GIT_DIR=$repo.git
+cvs_repo=$repo
 
-# seahorse has a ... "creative" directory layout
-if test $repo = seahorse; then
-    echo Adding seahorse svn import rules
-    rm -rf seahorse-plugins.git
-    GIT_DIR=seahorse-plugins.git git init --shared
-    export seahorse_plugins="create repository seahorse-plugins
-end repository
+case $repo in
 
-match ^/plugins
-replace /seahorse-plugins
-end match
+    seahorse)
+	submodules=seahorse-plugins
+	;;
 
-match /seahorse-plugins/branches/([^/+]+)/
-repository seahorse-plugins
-branch refs/branches/\1
-end match
+    gnomemm)
+	submodules="clutter-box2dmm clutter-cairomm clutter-gstreamermm clutter-gtkmm cluttermm cluttermm_tutorial gconfmm geglmm gnome-vfsmm gnomemm_docs gnomemm_hello goocanvasmm giomm gstreamermm gtkmm_hello libgdamm libglademm libgnomecanvasmm libgnomedbmm libgnomemm libgnomeuimm libpanelappletmm"
+	;;
 
-match /seahorse-plugins/tags/([^/+]+)/
-repository seahorse-plugins
-branch refs/tags/\1
-end match
+    gdm)
+	cvs_repo=gdm2
+	;;
+esac
 
-match /seahorse-plugins/trunk/*
-repository $repo
-branch master
-end match"
-fi
+for m in $repo $submodules; do
+    r=${m/\//-}
+    echo Deleting existing git dir $r.git
+    rm -rf $r.git
+done
 
-if test -d $GIT_DIR; then
-    echo Deleting existing git dir $GIT_DIR
-    rm -rf $GIT_DIR
-fi
+for m in $repo $submodules; do
+    GIT_DIR=$m.git git init --shared
+done
 
 echo Starting import of $repo [$(date)]
 
-if [ $repo = gdm ]; then
-    cvs_repo=gdm2
-else
-    cvs_repo=$repo
-fi
-
 if [ -d $cvs_repos/$cvs_repo ]; then
-    echo Running cvs export [$(date)]
-    run_parsecvs
+    echo Running cvs export for $repo [$(date)]
+    find $cvs_repos/$cvs_repo -name '*,v' | GIT_DIR=$repo.git $parsecvs
 else
     echo No cvs history [$(date)]
-    git init --shared
 fi
 
+for m in $submodules; do
+    if [ -d $cvs_repos/$cvs_repo/$m ]; then
+	echo Running cvs export for $m [$(date)]
+	find $cvs_repos/$cvs_repo/$m -name '*,v' | GIT_DIR=$m.git $parsecvs
+    fi
+done
+
 if [ -d $svn_repos/$repo ]; then
     echo Running svn export [$(date)]
-    run_fast_export
+    run_fast_export $submodules
 else
     echo No svn history [$(date)]
 fi
 
 echo All done [$(date)]
-date



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]