.gitignore
[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 sed -n 's/^create repository // p' ../rules | while read repo; do
26     if [ -e "$repo/refs/heads/tags" ]; then
27         cp -a "$repo/refs/heads/tags/." "$repo/refs/tags"
28         rm -rf "$repo/refs/heads/tags"
29     fi
30 done
31
32 pushd packages/invirt-dev.git
33 git tag sipb-xen-dev/13 sipb-xen-dev/14~2
34 popd
35
36 pushd packages/invirt-remote.git
37 echo $(git rev-parse 0.2.0 invirt-remote-server invirt-remote-host) >> info/grafts
38 git filter-branch --tag-name-filter cat -- ^invirt-remote-server ^invirt-remote-host --all
39 rm -rf info/grafts refs/original refs/heads/invirt-remote-server refs/heads/invirt-remote-host
40 popd
41
42 pushd packages/invirt-console.git
43 echo $(git rev-parse 0.2.0 0.2.0^ invirt-console-host) >> info/grafts
44 git filter-branch --tag-name-filter cat -- ^0.2.0^ ^invirt-console-host --all
45 rm -rf info/grafts refs/original refs/heads/invirt-console-host
46 popd
47
48 pushd packages/invirt-dns.git
49 echo $(git rev-parse sipb-xen-dns/1~10 sipb-xen-dns/1~11 dns) >> info/grafts
50 git filter-branch --tag-name-filter cat -- ^sipb-xen-dns/1~11 ^dns --all
51 rm -rf info/grafts refs/original refs/heads/dns
52 popd
53
54 pushd packages/invirt-database.git
55 echo $(git rev-parse invirt-database-server/0.0.1 0.0.1^) >> info/grafts
56 echo $(git rev-parse 0.2.0 0.2.0^ invirt-database-server) >> info/grafts
57 git filter-branch --tag-name-filter cat -- ^0.2.0^ --all
58 rm -rf info/grafts refs/original refs/heads/invirt-database-server
59 popd
60
61 pushd packages/python-routefs.git
62 git fetch -t git://github.com/ebroder/python-routefs.git
63 git branch -f upstream 1.0.1
64 git branch -f master 1.0.1-1
65 popd
66
67 echo
68 echo 'The Git migration was successful.'