common/bin/hgforest.sh

Print this page

        

*** 63,78 **** 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!" 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 fi rm -f -r ${tmp} --- 63,78 ---- rm -f -r ${tmp} mkdir -p ${tmp} safe_interrupt () { 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}/*.pid | tr '\n' ' '` 2> /dev/null wait echo Interrupt complete! fi fi rm -f -r ${tmp}
*** 170,183 **** ( ( 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} & else echo "cd ${i} && ${hg} $*" ! cd ${i} && ${hg} "$@" & fi echo $! > ${tmp}/${repopidfile}.pid ) 2>&1 | sed -e "s@^@${reponame}: @") & if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then --- 170,195 ---- ( ( if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`" echo ${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 no 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} "$@"; 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
*** 187,194 **** fi 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 ! --- 199,215 ---- fi done # Wait for all hg commands to complete wait ! # Terminate with exit 0 only if all subprocesses were successful ! ec=0 ! if [ -d ${tmp} ]; then ! for rc in `ls ${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}