-
Notifications
You must be signed in to change notification settings - Fork 3
/
svn2git-migration.sh
65 lines (48 loc) · 1.21 KB
/
svn2git-migration.sh
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
while read line
do
popd
repo="svn://$line"
echo "converting $line..."
svn ls --depth empty $repo
rc=$?
if [[ $rc != 0 ]] ; then
echo "repository does not exists: $repo"
continue
fi
github_remote=`php lib/create-github-repo.php $line`
rc=$?
if [[ $rc != 0 ]] ; then
echo "could not create repository on GitHub"
continue
fi
echo "repository created on GitHub: $github_remote"
mkdir $line
pushd $line
echo "svn2git $line"
svn2git $repo --authors ../authors-file.txt --notags --notrunk
rc=$?
if [[ $rc != 0 ]] ; then
echo "repository could not be converted"
continue
fi
echo "adding upstream remote"
git remote add upstream $github_remote
rc=$?
if [[ $rc != 0 ]] ; then
echo "could not add upstream remote"
continue
fi
git checkout dev
git push upstream dev
rc=$?
if [[ $rc != 0 ]] ; then
echo "could not push dev to upstream"
continue
fi
# create staging and master branches
git checkout -b staging dev
git push upstream staging
git checkout -b master staging
git push upstream master
done < "$1"