common/bin/hgforest.sh

changeset 1143
e3ae43560332
parent 1142
2bb0f1489885
child 1144
e16a393ee5e3
     1.1 --- a/common/bin/hgforest.sh	Wed Mar 26 16:56:58 2014 -0700
     1.2 +++ b/common/bin/hgforest.sh	Fri Apr 11 09:35:03 2014 +0100
     1.3 @@ -29,6 +29,7 @@
     1.4  status_output="/dev/stdout"
     1.5  qflag="false"
     1.6  vflag="false"
     1.7 +sflag="false"
     1.8  while [ $# -gt 0 ]
     1.9  do
    1.10    case $1 in
    1.11 @@ -43,6 +44,10 @@
    1.12        global_opts="${global_opts} -v"
    1.13        ;;
    1.14  
    1.15 +    -s | --sequential )
    1.16 +      sflag="true"
    1.17 +      ;;
    1.18 +
    1.19      '--' ) # no more options
    1.20        shift; break
    1.21        ;;
    1.22 @@ -63,7 +68,7 @@
    1.23  command_args="$@"
    1.24  
    1.25  usage() {
    1.26 -      echo "usage: $0 [-q|--quiet] [-v|--verbose] [--] <command> [commands...]" > ${status_output}
    1.27 +      echo "usage: $0 [-q|--quiet] [-v|--verbose] [-s|--sequential] [--] <command> [commands...]" > ${status_output}
    1.28        exit 1
    1.29  }
    1.30  
    1.31 @@ -243,11 +248,15 @@
    1.32        ) 2>&1 | sed -e "s@^@${reponame}:   @" > ${status_output}
    1.33      ) &
    1.34  
    1.35 -    if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then
    1.36 +    if [ `expr ${n} '%' ${at_a_time}` -eq 0 -a "${sflag}" = "false" ] ; then
    1.37        sleep 2
    1.38        echo "Waiting 5 secs before spawning next background command." > ${status_output}
    1.39        sleep 3
    1.40      fi
    1.41 +
    1.42 +    if [ "${sflag}" = "true" ] ; then
    1.43 +        wait
    1.44 +    fi
    1.45    done
    1.46  fi
    1.47  

mercurial