# HG changeset patch # User chegar # Date 1397205303 -3600 # Node ID 90d12e97510691f8603bac65a0172e0dcc3aecb9 # Parent 098340eccdcb6179197cc9b14ca51ba6d4f29ba6 8039990: Add sequential operation support to hgforest Reviewed-by: mduigou diff -r 098340eccdcb -r 90d12e975106 common/bin/hgforest.sh --- a/common/bin/hgforest.sh Thu Apr 10 14:35:49 2014 -0700 +++ b/common/bin/hgforest.sh Fri Apr 11 09:35:03 2014 +0100 @@ -29,6 +29,7 @@ status_output="/dev/stdout" qflag="false" vflag="false" +sflag="false" while [ $# -gt 0 ] do case $1 in @@ -43,6 +44,10 @@ global_opts="${global_opts} -v" ;; + -s | --sequential ) + sflag="true" + ;; + '--' ) # no more options shift; break ;; @@ -63,7 +68,7 @@ command_args="$@" usage() { - echo "usage: $0 [-q|--quiet] [-v|--verbose] [--] [commands...]" > ${status_output} + echo "usage: $0 [-q|--quiet] [-v|--verbose] [-s|--sequential] [--] [commands...]" > ${status_output} exit 1 } @@ -243,11 +248,15 @@ ) 2>&1 | sed -e "s@^@${reponame}: @" > ${status_output} ) & - if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then + 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 + wait + fi done fi