-
Notifications
You must be signed in to change notification settings - Fork 0
/
transfer.sh
executable file
·127 lines (101 loc) · 3.33 KB
/
transfer.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
# git账号@前面的英文全拼
username="wangyichen"
# 项目组名,参考git迁移.xlsx中的“项目组名”字段
team_name="dating"
# 工程名称,参考git迁移.xlsx中的“项目名”字段
project_name="hall"
# svn工程地址
pro_svn_repo="http://192.168.10.4/svn/Department_GameHall/project/client"
# git项目地址
pro_git_repo="http://192.168.10.7:8090/client/projects/dating/hall/project.git"
# cocosstudio svn地址
cstudio_svn_repo="http://192.168.10.4/svn/Department_GameHall/project/share"
# cocosstudio git地址
cstudio_git_repo="http://192.168.10.7:8090/client/projects/dating/hall/cocosstudio.git"
# frameworks项目git地址
frameworks_git_repo="http://192.168.10.7:8090/client/projects/dating/hall/frameworks.git"
submodule_git_repo="http://192.168.10.7:8090/client/projects/submodule.git"
if [ -z "$team_name" -o -z "$project_name" ]
then
echo "please specify team_name and project_name"
exit 1
fi
if [ -z "$pro_svn_repo" -o -z "$pro_git_repo" ]
then
echo "please specify pro_svn_repo and pro_git_repo"
exit 1
fi
if [ -z "$cstudio_svn_repo" -o -z "$cstudio_git_repo" ]
then
echo "please specify cstudio_svn_repo and cstudio_git_repo"
exit 1
fi
git config --global user.name $username
git config --global user.email "[email protected]"
git config --global credential.helper osxkeychain
sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level/SVN/ /Library/Perl/5.18/SVN
sudo mkdir /Library/Perl/5.18/auto
sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level/auto/SVN/ /Library/Perl/5.18/auto/SVN
mkdir $team_name
cd $team_name
if [ -d "$project_name" ]
then
rm -d -f -r $project_name
fi
echo "start transfer main project"
sh ../svn2git.sh -s $pro_svn_repo -g $pro_git_repo -p $project_name -i ../.gitignore -D
echo "end transfer main project"
if [ $? -ne 0 ]
then
echo "failed to tranfer"
exit 1
fi
echo "start commit frameworks"
git clone $frameworks_git_repo frameworks
cp -r $project_name/frameworks/runtime-src frameworks
cp ../.gitignore frameworks/.gitignore
cd frameworks
git add -A
git commit -a -m "frameworks first commit"
git push -u origin --all
cd ..
rm -d -f -r frameworks
echo "end commit frameworks"
echo "start transfer cocosstudio"
sh ../svn2git.sh -s $cstudio_svn_repo -g $cstudio_git_repo -p cocosstudio -i ../.gitignore -D
rm -d -f -r cocosstudio
echo "end transfer cocosstudio"
cd $project_name
if [ -d "frameworks" ]
then
echo "start delete frameworks"
rm -d -f -r frameworks
fi
git add -A
git commit -a -m "delete frameworks"
git push -u origin --all
echo "start add cocosstudio submodule"
git submodule add $cstudio_git_repo cocosstudio
git add .
git commit -m "add cocosstudio submodule"
git push -u origin --all
echo "end add cocosstudio submodule"
echo "start add frameworks submodule"
git submodule add $frameworks_git_repo frameworks
git add .
git commit -m "add frameworks submodule"
git push -u origin --all
echo "end add frameworks submodule"
echo "start add submodule submodule"
git submodule add $submodule_git_repo submodule
git add .
git commit -m "add submodule submodule"
git push -u origin --all
echo "end add submodule submodule"
git branch develop master
git commit -m "commit develop branch"
git push -u origin --all
git checkout develop
sudo chmod -R 775 .git
echo conver finish