81 done 82 at_a_time=8 83 # Any repos to deal with? 84 if [ "${repos}" = "" ] ; then 85 echo "No repositories to process." 86 exit 87 fi 88 fi 89 90 # Echo out what repositories we will clone 91 echo "# Repos: ${repos} ${repos_extra}" 92 93 # Run the supplied command on all repos in parallel, save output until end 94 n=0 95 for i in ${repos} ; do 96 echo "Starting on ${i}" 97 n=`expr ${n} '+' 1` 98 ( 99 ( 100 if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then 101 cline="hg clone ${pull_default}/${i} ${i}" 102 echo "# ${cline}" 103 ( eval "${cline}" ) 104 else 105 cline="hg $*" 106 echo "# cd ${i} && ${cline}" 107 ( cd ${i} && eval "${cline}" ) 108 fi 109 echo "# exit code $?" 110 ) > ${tmp}/repo.${n} 2>&1 ; cat ${tmp}/repo.${n} ) & 111 if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then 112 sleep 5 113 fi 114 done 115 # Wait for all hg commands to complete 116 wait 117 118 if [ "${repos_extra}" != "" ] ; then 119 for i in ${repos_extra} ; do 120 echo "Starting on ${i}" 121 n=`expr ${n} '+' 1` 122 ( 123 ( 124 cline="hg clone ${pull_extra}/${i} ${i}" 125 echo "# ${cline}" 126 ( eval "${cline}" ) 127 echo "# exit code $?" 128 ) > ${tmp}/repo.${n} 2>&1 ; cat ${tmp}/repo.${n} ) & 129 if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then 130 sleep 5 131 fi 132 done 133 # Wait for all hg commands to complete 134 wait 135 fi 136 137 # Cleanup 138 rm -f -r ${tmp} 139 140 # Terminate with exit 0 all the time (hard to know when to say "failed") 141 exit 0 142 | 81 done 82 at_a_time=8 83 # Any repos to deal with? 84 if [ "${repos}" = "" ] ; then 85 echo "No repositories to process." 86 exit 87 fi 88 fi 89 90 # Echo out what repositories we will clone 91 echo "# Repos: ${repos} ${repos_extra}" 92 93 # Run the supplied command on all repos in parallel, save output until end 94 n=0 95 for i in ${repos} ; do 96 echo "Starting on ${i}" 97 n=`expr ${n} '+' 1` 98 ( 99 ( 100 if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then 101 pull_newrepo="`echo ${pull_default}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`" 102 cline="hg clone ${pull_newrepo} ${i}" 103 echo "# ${cline}" 104 ( eval "${cline}" ) 105 else 106 cline="hg $*" 107 echo "# cd ${i} && ${cline}" 108 ( cd ${i} && eval "${cline}" ) 109 fi 110 echo "# exit code $?" 111 ) > ${tmp}/repo.${n} 2>&1 ; cat ${tmp}/repo.${n} ) & 112 if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then 113 sleep 5 114 fi 115 done 116 # Wait for all hg commands to complete 117 wait 118 119 if [ "${repos_extra}" != "" ] ; then 120 for i in ${repos_extra} ; do 121 echo "Starting on ${i}" 122 n=`expr ${n} '+' 1` 123 ( 124 ( 125 pull_newextrarepo="`echo ${pull_extra}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`" 126 cline="hg clone ${pull_newextrarepo} ${i}" 127 echo "# ${cline}" 128 ( eval "${cline}" ) 129 echo "# exit code $?" 130 ) > ${tmp}/repo.${n} 2>&1 ; cat ${tmp}/repo.${n} ) & 131 if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then 132 sleep 5 133 fi 134 done 135 # Wait for all hg commands to complete 136 wait 137 fi 138 139 # Cleanup 140 rm -f -r ${tmp} 141 142 # Terminate with exit 0 all the time (hard to know when to say "failed") 143 exit 0 144 |