summaryrefslogtreecommitdiff
path: root/ooo-build-svn-to-git.sh
blob: 4d47bbf1a81d2a43b818984572f0e71500159cf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash

# Use like:
# ( time ./ooo-svn-to-git.sh /disk/git/svn /local/test/ooo-build ) 2>&1 | tee .log

SOURCE="$1"
TARGET="$2"

COMMITTERS="ooo-build-committers.txt"
LAYOUT="ooo-build-repositories.txt"

WD=`pwd`

if [ ! -d "$SOURCE" -o -e "$TARGET" -o -z "$TARGET" ] ; then
    cat 1>&2 <<EOF
Usage: ooo-build-svn-to-git.sh source target

source Directory with the SVN repo
target Directory where the resulting git repos are created (must not exist)
EOF
    exit 1;
fi

mkdir -p "$TARGET"
rm *.dump

for I in `sed -e 's/^[#:].*//' -e 's/^did-not-fit-anywhere.*//' -e 's/=.*//' "$LAYOUT" | grep -v '^$'` ; do
    mkdir "$TARGET/$I"
    mkfifo $I.dump
    ( cd "$TARGET/$I" ; git init ; git fast-import < "$WD"/$I.dump ) &
done

./svn-fast-export "$SOURCE" "$COMMITTERS" "$LAYOUT"

# wait until everything's finished
while [ -n "`jobs`" ] ; do
    echo jobs:
    jobs
    sleep 1
done

for I in `sed -e 's/^[#:].*//' -e 's/^did-not-fit-anywhere.*//' -e 's/=.*//' "$LAYOUT" | grep -v '^$'` ; do
    ( cd "$TARGET/$I" ; echo `pwd` ; git branch | sed 's/^\*/ /' | grep 'tag-branches/' | xargs git branch -D )
    rm $I.dump
done