Populate the superrepo as part of the git migration.
[invirt/scripts/git-migration.git] / git-migrate-fast.sh
index 9835e8e..56c2927 100755 (executable)
@@ -3,8 +3,9 @@ set -e
 
 # Depends: python-yaml, python-mako
 # and svn-all-fast-export, which comes from git://repo.or.cz/svn-all-fast-export
+# (except you actually want git://andersk.mit.edu/svn-all-fast-export localtime)
 # and builds with `qmake && make` with
-#   Build-Depends: qt4-qmake, libqt4-dev, libsvn-dev
+#   Build-Depends: libqt4-dev, libsvn-dev
 
 # Usage: ./git-migrate-fast.sh [svn-uri]
 # Exports into new subdir ./git .
@@ -62,5 +63,41 @@ git branch -f upstream 1.0.1
 git branch -f master 1.0.1-1
 popd
 
+mkdir packages.git
+pushd packages.git
+git init --bare
+(
+    echo 'commit refs/heads/prod'
+    echo 'mark :1'
+    echo 'committer Invirt Git Import <invirt@mit.edu> now'
+    echo 'data <<EOF'
+    echo 'Initial superrepo creation.'
+    echo 'EOF'
+    for r in $(ls ../packages); do
+       pushd "../packages/$r" &>/dev/null
+       commit="$(git rev-parse refs/heads/master)"
+       popd &>/dev/null
+
+       echo "M 160000 $commit ${r%.git}"
+    done
+
+    echo 'M 100644 inline .gitmodules'
+    echo 'data <<EOF'
+    for r in $(ls ../packages); do
+       r="${r%.git}"
+       printf '[submodule "%s"]\n' "$r"
+       printf '\tpath = %s\n' "$r"
+       printf '\turl = git://invirt.mit.edu/packages/%s.git\n' "$r"
+    done
+    echo 'EOF'
+
+    echo 'reset refs/heads/dev'
+    echo 'from :1'
+
+    echo 'reset HEAD'
+    echo 'from :1'
+) | git fast-import --date-format=now
+popd
+
 echo
 echo 'The Git migration was successful.'