[1901] | 1 | #!/bin/bash |
---|
| 2 | set -e |
---|
| 3 | |
---|
[2353] | 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 . |
---|
[1902] | 11 | SVN=${1:-/mit/xvm/svn} |
---|
| 12 | |
---|
[1901] | 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 | |
---|
[1941] | 23 | svn-all-fast-export --identity-map ../authors ../rules "$SVN" |
---|
[1901] | 24 | |
---|
[2356] | 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 |
---|
[1920] | 29 | |
---|
[2356] | 30 | svn path=/package_tags/sipb-xen-dev/13/; revision=316 |
---|
| 31 | EOF |
---|
[2015] | 32 | popd |
---|
| 33 | |
---|
[1920] | 34 | pushd packages/invirt-remote.git |
---|
[2356] | 35 | echo $(git rev-parse 0.2.0^0 invirt-remote-server invirt-remote-host) >> info/grafts |
---|
[1920] | 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 |
---|
[2356] | 41 | echo $(git rev-parse 0.2.0^0 0.2.0^ invirt-console-host) >> info/grafts |
---|
[1920] | 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 | |
---|
[2236] | 52 | pushd packages/invirt-database.git |
---|
[2356] | 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 |
---|
[2236] | 55 | git filter-branch --tag-name-filter cat -- ^0.2.0^ --all |
---|
| 56 | rm -rf info/grafts refs/original refs/heads/invirt-database-server |
---|
[1956] | 57 | popd |
---|
| 58 | |
---|
[1922] | 59 | pushd packages/python-routefs.git |
---|
[1939] | 60 | git fetch -t git://github.com/ebroder/python-routefs.git |
---|
| 61 | git branch -f upstream 1.0.1 |
---|
[1922] | 62 | git branch -f master 1.0.1-1 |
---|
| 63 | popd |
---|
| 64 | |
---|
[1920] | 65 | echo |
---|
| 66 | echo 'The Git migration was successful.' |
---|