svn-all-fast-export can create annotated tags now.
[invirt/scripts/git-migration.git] / git-migrate-fast.sh
1 #!/bin/bash
2 set -e
3
4 # Depends: python-yaml, python-mako
5 # and svn-all-fast-export, which comes from git://repo.or.cz/svn-all-fast-export
6 # and builds with `qmake && make` with
7 #   Build-Depends: qt4-qmake, libqt4-dev, libsvn-dev
8
9 # Usage: ./git-migrate-fast.sh [svn-uri]
10 # Exports into new subdir ./git .
11 SVN=${1:-/mit/xvm/svn}
12
13 mako-render rules.mako > rules
14
15 rm git -rf
16 mkdir git
17 cd git
18
19 sed -n 's/^create repository // p' ../rules | while read repo; do
20     mkdir -p "$repo" && GIT_DIR="$repo" git init --bare
21 done
22
23 svn-all-fast-export --identity-map ../authors ../rules "$SVN"
24
25 pushd packages/invirt-dev.git
26 GIT_COMMITTER_NAME='Eric Price' GIT_COMMITTER_EMAIL='ecprice@mit.edu' GIT_COMMITTER_DATE='1206829393 -0400' \
27     git tag -a sipb-xen-dev/13 sipb-xen-dev/14~2 -F - <<EOF
28 Tag 13 of sipb-xen-dev
29
30 svn path=/package_tags/sipb-xen-dev/13/; revision=316
31 EOF
32 popd
33
34 pushd packages/invirt-remote.git
35 echo $(git rev-parse 0.2.0^0 invirt-remote-server invirt-remote-host) >> info/grafts
36 git filter-branch --tag-name-filter cat -- ^invirt-remote-server ^invirt-remote-host --all
37 rm -rf info/grafts refs/original refs/heads/invirt-remote-server refs/heads/invirt-remote-host
38 popd
39
40 pushd packages/invirt-console.git
41 echo $(git rev-parse 0.2.0^0 0.2.0^ invirt-console-host) >> info/grafts
42 git filter-branch --tag-name-filter cat -- ^0.2.0^ ^invirt-console-host --all
43 rm -rf info/grafts refs/original refs/heads/invirt-console-host
44 popd
45
46 pushd packages/invirt-dns.git
47 echo $(git rev-parse sipb-xen-dns/1~10 sipb-xen-dns/1~11 dns) >> info/grafts
48 git filter-branch --tag-name-filter cat -- ^sipb-xen-dns/1~11 ^dns --all
49 rm -rf info/grafts refs/original refs/heads/dns
50 popd
51
52 pushd packages/invirt-database.git
53 echo $(git rev-parse invirt-database-server/0.0.1^0 0.0.1^) >> info/grafts
54 echo $(git rev-parse 0.2.0^0 0.2.0^ invirt-database-server) >> info/grafts
55 git filter-branch --tag-name-filter cat -- ^0.2.0^ --all
56 rm -rf info/grafts refs/original refs/heads/invirt-database-server
57 popd
58
59 pushd packages/python-routefs.git
60 git fetch -t git://github.com/ebroder/python-routefs.git
61 git branch -f upstream 1.0.1
62 git branch -f master 1.0.1-1
63 popd
64
65 echo
66 echo 'The Git migration was successful.'