Accept the path to the svn repository as an argument.
[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 echo run > ../run.gdb
17 gdb -batch -x ../run.gdb --args svn-all-fast-export ../rules "$SVN"
18
19 sed -n 's/^create repository // p' ../rules | while read repo; do
20     ! [ -e "$repo/refs/heads/tags" ] || \
21         cp -a "$repo/refs/heads/tags/." "$repo/refs/tags" && \
22         rm -rf "$repo/refs/heads/tags"
23 done