Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8
提交
3f380d13
D
dragonwell8
项目概览
openanolis
/
dragonwell8
通知
5
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3f380d13
编写于
2月 06, 2013
作者:
C
chegar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8007625: race with nested repos in /common/bin/hgforest.sh
Reviewed-by: dholmes, ohair, ohrstrom
上级
3f0b33d5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
41 addition
and
20 deletion
+41
-20
common/bin/hgforest.sh
common/bin/hgforest.sh
+40
-19
get_source.sh
get_source.sh
+1
-1
未找到文件。
common/bin/hgforest.sh
浏览文件 @
3f380d13
...
...
@@ -64,33 +64,33 @@ rm -f -r ${tmp}
mkdir
-p
${
tmp
}
safe_interrupt
()
{
if
[
-d
${
tmp
}
]
;
then
if
[
"
`
ls
${
tmp
}
`
"
!=
""
]
;
then
echo
"Waiting for processes (
`
cat
${
tmp
}
/
*
|
tr
'\n'
' '
`
) to terminate nicely!"
if
[
-d
${
tmp
}
]
;
then
if
[
"
`
ls
${
tmp
}
/
*
.pid
`
"
!=
""
]
;
then
echo
"Waiting for processes (
`
cat
${
tmp
}
/
*
.pid
|
tr
'\n'
' '
`
) to terminate nicely!"
sleep
1
# Pipe stderr to dev/null to silence kill, that complains when trying to kill
# a subprocess that has already exited.
kill
-TERM
`
cat
${
tmp
}
/
*
|
tr
'\n'
' '
`
2> /dev/null
wait
echo
Interrupt
complete
!
fi
kill
-TERM
`
cat
${
tmp
}
/
*
.pid
|
tr
'\n'
' '
`
2> /dev/null
wait
echo
Interrupt
complete
!
fi
fi
rm
-f
-r
${
tmp
}
exit
1
}
nice_exit
()
{
if
[
-d
${
tmp
}
]
;
then
if
[
"
`
ls
${
tmp
}
`
"
!=
""
]
;
then
wait
fi
if
[
-d
${
tmp
}
]
;
then
if
[
"
`
ls
${
tmp
}
`
"
!=
""
]
;
then
wait
fi
fi
rm
-f
-r
${
tmp
}
}
trap
'safe_interrupt'
INT QUIT
trap
'nice_exit'
EXIT
# Only look in specific locations for possible forests (avoids long searches)
pull_default
=
""
repos
=
""
...
...
@@ -172,14 +172,26 @@ for i in ${repos} ${repos_extra} ; do
if
[
"
${
command
}
"
=
"clone"
-o
"
${
command
}
"
=
"fclone"
]
;
then
pull_newrepo
=
"
`
echo
${
pull_base
}
/
${
i
}
|
sed
-e
's@\([^:]/\)//*@\1@g'
`
"
echo
${
hg
}
clone
${
pull_newrepo
}
${
i
}
${
hg
}
clone
${
pull_newrepo
}
${
i
}
&
path
=
"
`
dirname
${
i
}
`
"
if
[
"
${
path
}
"
!=
"."
]
;
then
times
=
0
while
[
!
-d
"
${
path
}
"
]
## nested repo, ensure containing dir exists
do
times
=
`
expr
${
times
}
'+'
1
`
if
[
`
expr
${
times
}
'%'
10
`
-eq
0
]
;
then
echo
${
path
}
still not created, waiting...
fi
sleep
5
done
fi
(
${
hg
}
clone
${
pull_newrepo
}
${
i
}
;
echo
"
$?
"
>
${
tmp
}
/
${
repopidfile
}
.pid.rc
)
&
else
echo
"cd
${
i
}
&&
${
hg
}
$*
"
cd
${
i
}
&&
${
hg
}
"
$@
"
&
fi
cd
${
i
}
&&
(
${
hg
}
"
$@
"
;
echo
"
$?
"
>
${
tmp
}
/
${
repopidfile
}
.pid.rc
)
&
fi
echo
$!
>
${
tmp
}
/
${
repopidfile
}
.pid
)
2>&1 |
sed
-e
"s@^@
${
reponame
}
: @"
)
&
if
[
`
expr
${
n
}
'%'
${
at_a_time
}
`
-eq
0
]
;
then
sleep
2
echo
Waiting 5 secs before spawning next background command.
...
...
@@ -189,6 +201,15 @@ done
# Wait for all hg commands to complete
wait
# Terminate with exit 0 all the time (hard to know when to say "failed")
exit
0
# Terminate with exit 0 only if all subprocesses were successful
ec
=
0
if
[
-d
${
tmp
}
]
;
then
for
rc
in
${
tmp
}
/
*
.pid.rc
;
do
exit_code
=
`
cat
${
rc
}
|
tr
-d
' \n\r'
`
if
[
"
${
exit_code
}
"
!=
"0"
]
;
then
echo
"WARNING:
${
rc
}
exited abnormally."
ec
=
1
fi
done
fi
exit
${
ec
}
get_source.sh
浏览文件 @
3f380d13
...
...
@@ -26,7 +26,7 @@
#
# Get clones of all nested repositories
sh ./common/bin/hgforest.sh clone
"
$@
"
sh ./common/bin/hgforest.sh clone
"
$@
"
||
exit
1
# Update all existing repositories to the latest sources
sh ./common/bin/hgforest.sh pull
-u
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录