Put some more stuff in YAML.
[invirt/scripts/git-migration.git] / git-migrate-fast.sh
1 #!/bin/bash
2 set -e
3
4 SVN=${1:-/mit/xvm/svn}
5
6 mako-render rules.mako > rules
7
8 rm git -rf
9 mkdir git
10 cd git
11
12 sed -n 's/^create repository // p' ../rules | while read repo; do
13     mkdir -p "$repo" && GIT_DIR="$repo" git init --bare
14 done
15
16 svn-all-fast-export --identity-map ../authors ../rules "$SVN"
17
18 sed -n 's/^create repository // p' ../rules | while read repo; do
19     ! [ -e "$repo/refs/heads/tags" ] || \
20         cp -a "$repo/refs/heads/tags/." "$repo/refs/tags" && \
21         rm -rf "$repo/refs/heads/tags"
22 done
23
24 pushd packages/invirt-remote.git
25 echo $(git rev-parse 0.2.0 invirt-remote-server invirt-remote-host) >> info/grafts
26 git filter-branch --tag-name-filter cat -- ^invirt-remote-server ^invirt-remote-host --all
27 rm -rf info/grafts refs/original refs/heads/invirt-remote-server refs/heads/invirt-remote-host
28 popd
29
30 pushd packages/invirt-console.git
31 echo $(git rev-parse 0.2.0 0.2.0^ invirt-console-host) >> info/grafts
32 git filter-branch --tag-name-filter cat -- ^0.2.0^ ^invirt-console-host --all
33 rm -rf info/grafts refs/original refs/heads/invirt-console-host
34 popd
35
36 pushd packages/invirt-dns.git
37 echo $(git rev-parse sipb-xen-dns/1~10 sipb-xen-dns/1~11 dns) >> info/grafts
38 git filter-branch --tag-name-filter cat -- ^sipb-xen-dns/1~11 ^dns --all
39 rm -rf info/grafts refs/original refs/heads/dns
40 popd
41
42 pushd packages/libyaml.git
43 git fetch git://andersk.mit.edu/libyaml.git refs/tags/upstream/0.1.1:refs/tags/upstream/0.1.1 refs/tags/debian/0.1.1-1:refs/tags/debian/0.1.1-1
44 git branch upstream upstream/0.1.1
45 echo $(git rev-parse 0.1.1-1_andersk1 debian/0.1.1-1^0) >> info/grafts
46 git filter-branch --tag-name-filter cat -- ^debian/0.1.1-1 --all
47 rm -rf info/grafts refs/original
48 popd
49
50 pushd packages/python-routefs.git
51 git fetch -t git://github.com/ebroder/python-routefs.git
52 git branch -f upstream 1.0.1
53 git branch -f master 1.0.1-1
54 popd
55
56 echo
57 echo 'The Git migration was successful.'