-
Notifications
You must be signed in to change notification settings - Fork 2
/
git-export-svn-branches.sh
executable file
·55 lines (47 loc) · 2.05 KB
/
git-export-svn-branches.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
#!/usr/bin/env bash
#
# (c) 2010 David Soria Parra
# (c) 2010 Nils Adermann
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <[email protected]> and <[email protected] wrote this file.
# As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return.
# ----------------------------------------------------------------------------
# Configure this part
gitremote="github"
giturl="git://github.com/phpbb/phpbb3.git"
svnurl="http://code.phpbb.com/svn/phpbb/"
# either empty or "--no-auth-cache --username <user> --password <password>"
svnauth="--no-auth-cache --username git-gate"
svnbranches=( "trunk" "branches/phpBB-3_0_0" "branches/phpBB-3_0_7" )
gitbranches=( "develop" "develop-olympus" "prep-release-3.0.7" )
githashinsvn=( "b68de2323d6444b4b3685a98bbcb9500a38e45cb" "d62068cfadcc1478a2f8dd6e7da81dea6cee71ff" "872ad322ec69a032ec22d9e8ae19b9a8399d7712" )
basedir=`dirname $0`
if [[ $basedir != /* ]]
then
basedir="../$basedir"
fi
for (( i = 0 ; i < ${#svnbranches[@]} ; i++ ))
do
svnbranch=${svnbranches[i]}
gitbranch=${gitbranches[i]}
echo "Updating svn $svnbranch from git $gitremote $gitbranch"
svnbranchname=`basename $svnbranch`
if [ ! -d "$svnbranchname" ]
then
echo "Creating svn checkout and initialising git repo"
svn co $svnauth $svnurl/$svnbranch/
cd $svnbranchname
echo ${githashinsvn[i]} > git-revision
git init
git remote add -t $gitbranch $gitremote $giturl
git fetch $gitremote
git checkout -b $gitbranch $gitremote/$gitbranch
cd ..
fi
cd $svnbranchname
$basedir/git-export-svn.sh $gitremote $gitbranch "$svnauth"
cd ..
done