Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8
提交
585f927a
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看板
提交
585f927a
编写于
4月 11, 2014
作者:
M
mduigou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8041151: More concurrent hgforest
Reviewed-by: chegar, erikj, sla
上级
fb7ce624
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
54 addition
and
12 deletion
+54
-12
common/bin/hgforest.sh
common/bin/hgforest.sh
+54
-12
未找到文件。
common/bin/hgforest.sh
浏览文件 @
585f927a
...
...
@@ -72,12 +72,21 @@ usage() {
exit
1
}
if
[
"x"
=
"x
$command
"
]
;
then
echo
"ERROR: No command to hg supplied!"
usage
fi
# Check if we can use fifos for monitoring sub-process completion.
on_windows
=
`
uname
-s
| egrep
-ic
-e
'cygwin|msys'
`
if
[
${
on_windows
}
=
"1"
]
;
then
# cygwin has (2014-04-18) broken (single writer only) FIFOs
# msys has (2014-04-18) no FIFOs.
have_fifos
=
"false"
else
have_fifos
=
"true"
fi
# Clean out the temporary directory that stores the pid files.
tmp
=
/tmp/forest.
$$
rm
-f
-r
${
tmp
}
...
...
@@ -210,7 +219,19 @@ if [ "${command}" = "serve" ] ; then
)
&
else
# Run the supplied command on all repos in parallel.
# n is the number of subprocess started or which might still be running.
n
=
0
if
[
$have_fifos
=
"true"
]
;
then
# if we have fifos use them to detect command completion.
mkfifo
${
tmp
}
/fifo
exec
3<
>
${
tmp
}
/fifo
if
[
"
${
sflag
}
"
=
"true"
]
;
then
# force sequential
at_a_time
=
1
fi
fi
for
i
in
${
repos
}
${
repos_extra
}
;
do
n
=
`
expr
${
n
}
'+'
1
`
repopidfile
=
`
echo
${
i
}
|
sed
-e
's@./@@'
-e
's@/@_@g'
`
...
...
@@ -221,10 +242,11 @@ else
pull_base
=
"
${
pull_extra
}
"
fi
done
pull_base
=
"
`
echo
${
pull_base
}
|
sed
-e
's@[/]*$@@'
`
"
(
(
if
[
"
${
command
}
"
=
"clone"
-o
"
${
command
}
"
=
"fclone"
-o
"
${
command
}
"
=
"tclone"
]
;
then
pull_newrepo
=
"
`
echo
${
pull_base
}
/
${
i
}
|
sed
-e
's@\([^:]/\)//*@\1@g'
`
"
pull_newrepo
=
"
${
pull_base
}
/
${
i
}
"
path
=
"
`
dirname
${
i
}
`
"
if
[
"
${
path
}
"
!=
"."
]
;
then
times
=
0
...
...
@@ -237,7 +259,7 @@ else
sleep
5
done
fi
echo
"hg clone
${
pull_newrepo
}
${
i
}
"
>
${
status_output
}
echo
"hg
${
global_opts
}
clone
${
pull_newrepo
}
${
i
}
"
>
${
status_output
}
(
PYTHONUNBUFFERED
=
true
hg
${
global_opts
}
clone
${
pull_newrepo
}
${
i
}
;
echo
"
$?
"
>
${
tmp
}
/
${
repopidfile
}
.pid.rc
)
2>&1 &
else
echo
"cd
${
i
}
&& hg
${
global_opts
}
${
command
}
${
command_args
}
"
>
${
status_output
}
...
...
@@ -246,21 +268,41 @@ else
echo
$!
>
${
tmp
}
/
${
repopidfile
}
.pid
)
2>&1 |
sed
-e
"s@^@
${
reponame
}
: @"
>
${
status_output
}
if
[
$have_fifos
=
"true"
]
;
then
echo
"
${
reponame
}
"
>
&3
fi
)
&
if
[
`
expr
${
n
}
'%'
${
at_a_time
}
`
-eq
0
-a
"
${
sflag
}
"
=
"false"
]
;
then
sleep
2
echo
"Waiting 5 secs before spawning next background command."
>
${
status_output
}
sleep
3
fi
if
[
"
${
sflag
}
"
=
"true"
]
;
then
if
[
$have_fifos
=
"true"
]
;
then
# check on count of running subprocesses and possibly wait for completion
if
[
${
at_a_time
}
-lt
${
n
}
]
;
then
# read will block until there are completed subprocesses
while
read
repo_done
;
do
n
=
`
expr
${
n
}
'-'
1
`
if
[
${
n
}
-lt
${
at_a_time
}
]
;
then
# we should start more subprocesses
break
;
fi
done
<&3
fi
else
if
[
"
${
sflag
}
"
=
"false"
]
;
then
# Compare completions to starts
completed
=
"
`
(
ls
-1
${
tmp
}
/
*
.pid.rc 2> /dev/null |
wc
-l
)
||
echo
0
`
"
while
[
${
at_a_time
}
-lt
`
expr
${
n
}
'-'
${
completed
}
`
]
;
do
# sleep a short time to give time for something to complete
sleep
1
completed
=
"
`
(
ls
-1
${
tmp
}
/
*
.pid.rc 2> /dev/null |
wc
-l
)
||
echo
0
`
"
done
else
# complete this task before starting another.
wait
fi
fi
done
fi
# Wait for all
hg command
s to complete
# Wait for all
subprocesse
s to complete
wait
# Terminate with exit 0 only if all subprocesses were successful
...
...
@@ -270,7 +312,7 @@ if [ -d ${tmp} ]; then
exit_code
=
`
cat
${
rc
}
|
tr
-d
' \n\r'
`
if
[
"
${
exit_code
}
"
!=
"0"
]
;
then
repo
=
"
`
echo
${
rc
}
|
sed
-e
s@^
${
tmp
}
@@
-e
's@/*\([^/]*\)\.pid\.rc$@\1@'
-e
's@_@/@g'
`
"
echo
"WARNING:
${
repo
}
exited abnormally
.
"
>
${
status_output
}
echo
"WARNING:
${
repo
}
exited abnormally
(
$exit_code
)
"
>
${
status_output
}
ec
=
1
fi
done
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录