common/bin/hgforest.sh

changeset 1133
50aaf272884f
parent 902
d832f6171acd
parent 1
2bcf2a10b799
child 1288
7801df19942d
equal deleted inserted replaced
1132:d117f01bfb4f 1133:50aaf272884f
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 # 20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any 22 # or visit www.oracle.com if you need additional information or have any
23 # questions. 23 # questions.
24 #
25
26 #
27 # This file has been modified by Loongson Technology in 2013. These
28 # modifications are Copyright (c) 2013 Loongson Technology, and are made
29 # available on the same license terms set forth above.
24 # 30 #
25 31
26 # Shell script for a fast parallel forest command 32 # Shell script for a fast parallel forest command
27 command="$1" 33 command="$1"
28 pull_extra_base="$2" 34 pull_extra_base="$2"
142 fi 148 fi
143 done 149 done
144 ( 150 (
145 ( 151 (
146 if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then 152 if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then
147 pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`" 153 # 2013.2.27 Jin: fix the repo url for ssh
154 #pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`"
155 pull_newrepo=${pull_base}/$i
148 echo hg clone ${pull_newrepo} ${i} 156 echo hg clone ${pull_newrepo} ${i}
149 path="`dirname ${i}`" 157 path="`dirname ${i}`"
150 if [ "${path}" != "." ] ; then 158 if [ "${path}" != "." ] ; then
151 times=0 159 times=0
152 while [ ! -d "${path}" ] ## nested repo, ensure containing dir exists 160 while [ ! -d "${path}" ] ## nested repo, ensure containing dir exists
156 echo ${path} still not created, waiting... 164 echo ${path} still not created, waiting...
157 fi 165 fi
158 sleep 5 166 sleep 5
159 done 167 done
160 fi 168 fi
161 (PYTHONUNBUFFERED=true hg clone ${pull_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc )& 169 (PYTHONUNBUFFERED=true hg clone ${pull_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc )
162 else 170 else
163 echo "cd ${i} && hg $*" 171 echo "cd ${i} && hg $*"
164 cd ${i} && (PYTHONUNBUFFERED=true hg "$@"; echo "$?" > ${tmp}/${repopidfile}.pid.rc )& 172 cd ${i} && (PYTHONUNBUFFERED=true hg "$@"; echo "$?" > ${tmp}/${repopidfile}.pid.rc )
165 fi 173 fi
166 echo $! > ${tmp}/${repopidfile}.pid 174 echo $! > ${tmp}/${repopidfile}.pid
167 ) 2>&1 | sed -e "s@^@${reponame}: @") & 175 ) 2>&1 | sed -e "s@^@${reponame}: @")
168 176
169 if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then 177 if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then
170 sleep 2 178 sleep 2
171 echo Waiting 5 secs before spawning next background command. 179 echo Waiting 5 secs before spawning next background command.
172 sleep 3 180 sleep 3

mercurial