Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-11-27 07:47:39 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
131f598ab5806d5f184f068b0d5b772d636a74e1
131f598a
1 parent
4c67ddca
use multiple remote to commit and sync with csdn+oschina.
显示空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
40 行增加
和
177 行删除
trunk/scripts/_log.sh
trunk/scripts/_mirror.utils.sh
trunk/scripts/csdn.mirror.sh
trunk/scripts/github.commit.sh
trunk/scripts/oschina.mirror.sh
trunk/scripts/_log.sh
查看文件 @
131f598
...
...
@@ -8,7 +8,7 @@ RED="\\e[31m"
GREEN
=
"
\\
e[32m"
YELLOW
=
"
\\
e[33m"
BLACK
=
"
\\
e[0m"
POS
=
"
\\
e[1
1
0G"
POS
=
"
\\
e[1
0
0G"
# if need to log to file, change the log path.
if
[[
!
$log
]]
;
then
...
...
trunk/scripts/_mirror.utils.sh
已删除
100755 → 0
查看文件 @
4c67ddc
#!/bin/bash
#############################################
# help for the first checkout.
#############################################
function
first_checkout
()
{
mirror_name
=
$1
git_url
=
$2
project_dir
=
$3
sync_script
=
$4
failed_msg
"当前分支不是
${
mirror_name
}
镜像"
;
cat
<<END
创建${mirror_name}镜像的过程如下:
1. 在${mirror_name}上创建项目,
可创建空项目,或从https://github.com/winlinvip/simple-rtmp-server拷贝过来。
2. 在本地虚拟机上:
git clone $git_url
cd $project_dir && git checkout master && git branch 1.0release && git push origin 1.0release
3. 创建同步的branch:
git remote add upstream https://github.com/winlinvip/simple-rtmp-server.git
git fetch upstream
git checkout upstream/master -b srs.master
git checkout upstream/1.0release -b srs.1.0release
4. 执行本同步更新脚本,更新。
bash $sync_script
END
}
#############################################
# branch master
#############################################
function
sync_master
()
{
for
((
;;
))
;
do
git checkout srs.master
&&
git pull
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
failed_msg
"(master)更新github分支失败,自动重试"
;
continue
else
ok_msg
"(master)更新github分支成功"
fi
break
done
git checkout master
&&
git merge srs.master
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
failed_msg
"(master)合并github分支失败, ret=
$ret
"
;
exit
$ret
;
fi
ok_msg
"(master)合并github分支成功"
}
#############################################
# branch 1.0release
#############################################
function
sync_1_0_release
()
{
for
((
;;
))
;
do
git checkout srs.1.0release
&&
git pull
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
failed_msg
"(1.0release)更新github分支失败,自动重试"
;
continue
else
ok_msg
"(1.0release)更新github分支成功"
fi
break
done
git checkout 1.0release
&&
git merge srs.1.0release
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
failed_msg
"(1.0release)合并github分支失败, ret=
$ret
"
;
exit
$ret
;
fi
ok_msg
"(1.0release)合并github分支成功"
}
#############################################
# push
#############################################
function
sync_push
()
{
mirror_name
=
$1
for
((
;;
))
;
do
git push
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
failed_msg
"提交
${
mirror_name
}
分支失败,自动重试"
;
continue
else
ok_msg
"提交
${
mirror_name
}
分支成功"
fi
break
done
git checkout master
ok_msg
"
${
mirror_name
}
同步git成功"
}
trunk/scripts/csdn.mirror.sh
已删除
100755 → 0
查看文件 @
4c67ddc
#!/bin/bash
echo
"更新CSDN镜像的脚本"
echo
"argv[0]=
$0
"
if
[[
! -f
$0
]]
;
then
echo
"directly execute the scripts on shell."
;
work_dir
=
`
pwd
`
else
echo
"execute scripts in file:
$0
"
;
work_dir
=
`
dirname
$0
`
;
work_dir
=
`
(
cd
${
work_dir
}
&&
pwd
)
`
fi
work_dir
=
`
(
cd
${
work_dir
}
/..
&&
pwd
)
`
product_dir
=
$work_dir
# allow start script from any dir
cd
$work_dir
&&
git checkout master
.
${
product_dir
}
/scripts/_log.sh
ret
=
$?
;
if
[[
$ret
-ne 0
]]
;
then
exit
$ret
;
fi
ok_msg
"导入脚本成功"
source
$work_dir
/scripts/_mirror.utils.sh
git remote -v|grep code.csdn.net >/dev/null 2>&1
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
first_checkout
"CSDN"
\
"git@code.csdn.net:winlinvip/srs-csdn.git"
\
"srs-csdn"
"
$work_dir
/scripts/csdn.mirror.sh"
exit
0;
fi
sync_master
sync_1_0_release
sync_push
"CSDN"
exit
0
trunk/scripts/github.commit.sh
查看文件 @
131f598
...
...
@@ -20,14 +20,46 @@ cd $work_dir && git checkout master
ret
=
$?
;
if
[[
$ret
-ne 0
]]
;
then
exit
$ret
;
fi
ok_msg
"导入脚本成功"
source
$work_dir
/scripts/_mirror.utils.sh
function
remote_check
()
{
remote
=
$1
url
=
$2
git remote -v| grep
"
$url
"
>/dev/null 2>&1
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
echo
"remote
$remote
not found, add by:"
echo
" git remote add
$remote
$url
"
exit
-1
fi
ok_msg
"remote
$remote
ok, url is
$url
"
}
remote_check origin git@github.com:winlinvip/simple-rtmp-server.git
remote_check srs.csdn git@code.csdn.net:winlinvip/srs-csdn.git
remote_check srs.oschina git@git.oschina.net:winlinvip/srs.oschina.git
git remote -v|grep github.com >/dev/null 2>&1
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
echo
"current not under github.com branch"
exit
-1;
fi
function
sync_push
()
{
repository
=
$1
branch
=
$2
for
((
;;
))
;
do
git push
$repository
$branch
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
failed_msg
"提交
$repository
/
$branch
分支失败,自动重试"
;
continue
else
ok_msg
"提交
$repository
/
$branch
分支成功"
fi
break
done
ok_msg
"
$repository
/
$branch
同步git成功"
}
sync_push
"Github"
sync_push origin master
sync_push origin 1.0release
sync_push srs.csdn master
sync_push srs.csdn 1.0release
sync_push srs.oschina master
sync_push srs.oschina 1.0release
ok_msg
"sync push ok"
exit
0
...
...
trunk/scripts/oschina.mirror.sh
已删除
100755 → 0
查看文件 @
4c67ddc
#!/bin/bash
echo
"更新OSChina镜像的脚本"
echo
"argv[0]=
$0
"
if
[[
! -f
$0
]]
;
then
echo
"directly execute the scripts on shell."
;
work_dir
=
`
pwd
`
else
echo
"execute scripts in file:
$0
"
;
work_dir
=
`
dirname
$0
`
;
work_dir
=
`
(
cd
${
work_dir
}
&&
pwd
)
`
fi
work_dir
=
`
(
cd
${
work_dir
}
/..
&&
pwd
)
`
product_dir
=
$work_dir
# allow start script from any dir
cd
$work_dir
&&
git checkout master
.
${
product_dir
}
/scripts/_log.sh
ret
=
$?
;
if
[[
$ret
-ne 0
]]
;
then
exit
$ret
;
fi
ok_msg
"导入脚本成功"
source
$work_dir
/scripts/_mirror.utils.sh
git remote -v|grep git.oschina.net >/dev/null 2>&1
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
first_checkout
"OSChina"
\
"git@git.oschina.net:winlinvip/srs.oschina.git"
\
"srs.oschina"
"
$work_dir
/scripts/oschina.mirror.sh"
exit
0;
fi
sync_master
sync_1_0_release
sync_push
"OSChina"
exit
0
请
注册
或
登录
后发表评论