Cleanup invirt-web's cherrypy-rebased -> trunk merge in the git-migration
[invirt/scripts/git-migration.git] / git-migrate-fast.sh
index 9835e8e..1cde7d5 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
 
 # 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
 # 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 .
 
 # Usage: ./git-migrate-fast.sh [svn-uri]
 # Exports into new subdir ./git .
@@ -17,7 +18,7 @@ mkdir git
 cd git
 
 sed -n 's/^create repository // p' ../rules | while read repo; do
 cd git
 
 sed -n 's/^create repository // p' ../rules | while read repo; do
-    mkdir -p "$repo" && GIT_DIR="$repo" git init --bare
+    mkdir -p "$repo" && GIT_DIR="$repo" git init --bare && GIT_DIR="$repo" git symbolic-ref HEAD refs/heads/prod
 done
 
 svn-all-fast-export --identity-map ../authors ../rules "$SVN"
 done
 
 svn-all-fast-export --identity-map ../authors ../rules "$SVN"
@@ -56,10 +57,66 @@ git filter-branch --tag-name-filter cat -- ^0.2.0^ --all
 rm -rf info/grafts refs/original refs/heads/invirt-database-server
 popd
 
 rm -rf info/grafts refs/original refs/heads/invirt-database-server
 popd
 
+pushd packages/invirt-web.git
+echo $(git rev-parse 0.1.0^0 0.0.24^0 cherrypy-rebased^1) >> info/grafts
+echo $(git rev-parse 0.1.1~3 0.1.0^0 cherrypy-rebased^0) >> info/grafts
+git filter-branch --tag-name-filter cat -- ^0.0.24^ --all
+rm -rf info/grafts refs/original
+popd
+
 pushd packages/python-routefs.git
 git fetch -t git://github.com/ebroder/python-routefs.git
 git branch -f upstream 1.0.1
 pushd packages/python-routefs.git
 git fetch -t git://github.com/ebroder/python-routefs.git
 git branch -f upstream 1.0.1
-git branch -f master 1.0.1-1
+git branch -f prod 1.0.1-1
+popd
+
+pushd packages/python-afs.git
+git fetch -t git://github.com/ebroder/pyafs.git
+git branch -f upstream 0.1.1
+git branch -f prod 0.1.1-1
+popd
+
+for r in $(ls packages); do
+    pushd "packages/$r"
+    git branch dev prod
+    popd
+done
+
+mkdir packages.git
+pushd packages.git
+git init --bare
+git symbolic-ref HEAD refs/heads/prod
+(
+    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/prod)"
+       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/invirt/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
 popd
 
 echo