348 if [ "${command}" = "clone" -o "${command}" = "fclone" -o "${command}" = "tclone" ] ; then 349 # some form of clone 350 clone_newrepo="${pull_base}/${i}" 351 parent_path="`dirname ${i}`" 352 if [ "${parent_path}" != "." ] ; then 353 times=0 354 while [ ! -d "${parent_path}" ] ; do ## nested repo, ensure containing dir exists 355 if [ "${sflag}" = "true" ] ; then 356 # Missing parent is fatal during sequential operation. 357 echo "ERROR: Missing parent path: ${parent_path}" > ${status_output} 358 exit 1 359 fi 360 times=`expr ${times} '+' 1` 361 if [ `expr ${times} '%' 10` -eq 0 ] ; then 362 echo "${parent_path} still not created, waiting..." > ${status_output} 363 fi 364 sleep 5 365 done 366 fi 367 # run the clone command. 368 echo "hg${global_opts} clone ${clone_newrepo} ${i}" > ${status_output} 369 (PYTHONUNBUFFERED=true hg${global_opts} clone ${clone_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 & 370 else 371 # run the command. 372 echo "cd ${i} && hg${global_opts} ${command} ${@}" > ${status_output} 373 cd ${i} && (PYTHONUNBUFFERED=true hg${global_opts} ${command} "${@}"; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 & 374 fi 375 376 echo $! > ${tmp}/${repopidfile}.pid 377 ) 2>&1 | sed -e "s@^@${reponame}: @" > ${status_output} 378 # tell the fifo waiter that this subprocess is done. 379 if [ ${have_fifos} = "true" ]; then 380 echo "${i}" >&3 381 fi 382 ) & 383 384 if [ "${sflag}" = "true" ] ; then 385 # complete this task before starting another. 386 wait 387 else 388 if [ "${have_fifos}" = "true" ]; then 389 # check on count of running subprocesses and possibly wait for completion | 348 if [ "${command}" = "clone" -o "${command}" = "fclone" -o "${command}" = "tclone" ] ; then 349 # some form of clone 350 clone_newrepo="${pull_base}/${i}" 351 parent_path="`dirname ${i}`" 352 if [ "${parent_path}" != "." ] ; then 353 times=0 354 while [ ! -d "${parent_path}" ] ; do ## nested repo, ensure containing dir exists 355 if [ "${sflag}" = "true" ] ; then 356 # Missing parent is fatal during sequential operation. 357 echo "ERROR: Missing parent path: ${parent_path}" > ${status_output} 358 exit 1 359 fi 360 times=`expr ${times} '+' 1` 361 if [ `expr ${times} '%' 10` -eq 0 ] ; then 362 echo "${parent_path} still not created, waiting..." > ${status_output} 363 fi 364 sleep 5 365 done 366 fi 367 # run the clone command. 368 echo "hg${global_opts} clone -U ${clone_newrepo} ${i}" > ${status_output} 369 (PYTHONUNBUFFERED=true hg${global_opts} clone -U ${clone_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 & 370 else 371 # run the command. 372 echo "cd ${i} && hg${global_opts} ${command} ${@}" > ${status_output} 373 cd ${i} && (PYTHONUNBUFFERED=true hg${global_opts} ${command} "${@}"; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 & 374 fi 375 376 echo $! > ${tmp}/${repopidfile}.pid 377 ) 2>&1 | sed -e "s@^@${reponame}: @" > ${status_output} 378 # tell the fifo waiter that this subprocess is done. 379 if [ ${have_fifos} = "true" ]; then 380 echo "${i}" >&3 381 fi 382 ) & 383 384 if [ "${sflag}" = "true" ] ; then 385 # complete this task before starting another. 386 wait 387 else 388 if [ "${have_fifos}" = "true" ]; then 389 # check on count of running subprocesses and possibly wait for completion |