486N/A# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 274N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 274N/A# This code is free software; you can redistribute it and/or modify it 274N/A# under the terms of the GNU General Public License version 2 only, as 274N/A# published by the Free Software Foundation. 274N/A# This code is distributed in the hope that it will be useful, but WITHOUT 274N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 274N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 274N/A# version 2 for more details (a copy is included in the LICENSE file that 274N/A# accompanied this code). 274N/A# You should have received a copy of the GNU General Public License version 274N/A# 2 along with this work; if not, write to the Free Software Foundation, 274N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 274N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 274N/A# Shell script for a fast parallel forest command 274N/A# Remove tmp area on A. B. Normal termination 274N/A# Only look in specific locations for possible forests (avoids long searches) 486N/Aif [
"${command}" =
"clone" -o
"${command}" =
"fclone" ] ;
then 486N/A if [
"${pull_default}" =
"" ] ;
then 486N/A echo "ERROR: Need initial clone with 'hg paths default' defined" 274N/A if [
"${pull_default}" =
"" ] ;
then 486N/A echo "ERROR: Need initial repository to use this script" 486N/A if [
"${pull_extra_base}" !=
"" ] ;
then 486N/A # Any repos to deal with? 486N/A if [
"${repos}" =
"" -a
"${repos_extra}" =
"" ] ;
then 486N/A echo "No repositories to clone." 274N/A # Derive repository names from the .hg directory locations 486N/A # Any repos to deal with? 486N/A if [
"${repos}" =
"" ] ;
then 486N/A echo "No repositories to process." 486N/A# Echo out what repositories we will clone 486N/Aecho "# Repos: ${repos} ${repos_extra}" 274N/A# Run the supplied command on all repos in parallel, save output until end 274N/A echo "Starting on ${i}" 486N/A if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then 274N/A echo "# cd ${i} && ${cline}" 274N/A ( cd ${i} && eval "${cline}" ) 488N/A# Wait for all hg commands to complete 486N/Aif [
"${repos_extra}" !=
"" ] ;
then 486N/A echo "Starting on ${i}" 488N/A # Wait for all hg commands to complete 274N/A# Terminate with exit 0 all the time (hard to know when to say "failed")