Populate the superrepo as part of the git migration.
authorEvan Broder <broder@mit.edu>
Sat, 5 Dec 2009 20:18:21 +0000 (15:18 -0500)
committerEvan Broder <broder@mit.edu>
Sat, 5 Dec 2009 20:18:21 +0000 (15:18 -0500)
svn path=/trunk/scripts/git-migration/; revision=2576

git-migrate-fast.sh

index 66be321..56c2927 100755 (executable)
@@ -63,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.'