source: trunk/scripts/git-migration/git-migrate-fast.sh @ 2577

Last change on this file since 2577 was 2577, checked in by broder, 14 years ago

Stuff all of our repos into an /invirt subdirectory, so that we have
room for future expansion.

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#!/bin/bash
2set -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# (except you actually want git://andersk.mit.edu/svn-all-fast-export localtime)
7# and builds with `qmake && make` with
8#   Build-Depends: libqt4-dev, libsvn-dev
9
10# Usage: ./git-migrate-fast.sh [svn-uri]
11# Exports into new subdir ./git .
12SVN=${1:-/mit/xvm/svn}
13
14mako-render rules.mako > rules
15
16rm git -rf
17mkdir git
18cd git
19
20sed -n 's/^create repository // p' ../rules | while read repo; do
21    mkdir -p "$repo" && GIT_DIR="$repo" git init --bare
22done
23
24svn-all-fast-export --identity-map ../authors ../rules "$SVN"
25
26pushd packages/invirt-dev.git
27GIT_COMMITTER_NAME='Eric Price' GIT_COMMITTER_EMAIL='ecprice@mit.edu' GIT_COMMITTER_DATE='1206829393 -0400' \
28    git tag -a sipb-xen-dev/13 sipb-xen-dev/14~2 -F - <<EOF
29Tag 13 of sipb-xen-dev
30
31svn path=/package_tags/sipb-xen-dev/13/; revision=316
32EOF
33popd
34
35pushd packages/invirt-remote.git
36echo $(git rev-parse 0.2.0^0 invirt-remote-server invirt-remote-host) >> info/grafts
37git filter-branch --tag-name-filter cat -- ^invirt-remote-server ^invirt-remote-host --all
38rm -rf info/grafts refs/original refs/heads/invirt-remote-server refs/heads/invirt-remote-host
39popd
40
41pushd packages/invirt-console.git
42echo $(git rev-parse 0.2.0^0 0.2.0^ invirt-console-host) >> info/grafts
43git filter-branch --tag-name-filter cat -- ^0.2.0^ ^invirt-console-host --all
44rm -rf info/grafts refs/original refs/heads/invirt-console-host
45popd
46
47pushd packages/invirt-dns.git
48echo $(git rev-parse sipb-xen-dns/1~10 sipb-xen-dns/1~11 dns) >> info/grafts
49git filter-branch --tag-name-filter cat -- ^sipb-xen-dns/1~11 ^dns --all
50rm -rf info/grafts refs/original refs/heads/dns
51popd
52
53pushd packages/invirt-database.git
54echo $(git rev-parse invirt-database-server/0.0.1^0 0.0.1^) >> info/grafts
55echo $(git rev-parse 0.2.0^0 0.2.0^ invirt-database-server) >> info/grafts
56git filter-branch --tag-name-filter cat -- ^0.2.0^ --all
57rm -rf info/grafts refs/original refs/heads/invirt-database-server
58popd
59
60pushd packages/python-routefs.git
61git fetch -t git://github.com/ebroder/python-routefs.git
62git branch -f upstream 1.0.1
63git branch -f master 1.0.1-1
64popd
65
66mkdir packages.git
67pushd packages.git
68git init --bare
69(
70    echo 'commit refs/heads/prod'
71    echo 'mark :1'
72    echo 'committer Invirt Git Import <invirt@mit.edu> now'
73    echo 'data <<EOF'
74    echo 'Initial superrepo creation.'
75    echo 'EOF'
76    for r in $(ls ../packages); do
77        pushd "../packages/$r" &>/dev/null
78        commit="$(git rev-parse refs/heads/master)"
79        popd &>/dev/null
80
81        echo "M 160000 $commit ${r%.git}"
82    done
83
84    echo 'M 100644 inline .gitmodules'
85    echo 'data <<EOF'
86    for r in $(ls ../packages); do
87        r="${r%.git}"
88        printf '[submodule "%s"]\n' "$r"
89        printf '\tpath = %s\n' "$r"
90        printf '\turl = git://invirt.mit.edu/invirt/packages/%s.git\n' "$r"
91    done
92    echo 'EOF'
93
94    echo 'reset refs/heads/dev'
95    echo 'from :1'
96
97    echo 'reset HEAD'
98    echo 'from :1'
99) | git fast-import --date-format=now
100popd
101
102echo
103echo 'The Git migration was successful.'
Note: See TracBrowser for help on using the repository browser.