Wed, 26 Mar 2014 16:56:58 -0700
8038435: Some hgforest.sh commands don't receive parameters
Reviewed-by: katleman
common/bin/hgforest.sh | file | annotate | diff | comparison | revisions |
1.1 --- a/common/bin/hgforest.sh Tue May 06 13:57:30 2014 -0700 1.2 +++ b/common/bin/hgforest.sh Wed Mar 26 16:56:58 2014 -0700 1.3 @@ -1,4 +1,4 @@ 1.4 -#!/bin/bash 1.5 +#!/bin/sh 1.6 1.7 # 1.8 # Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 1.9 @@ -60,10 +60,10 @@ 1.10 1.11 1.12 command="$1"; shift 1.13 -repo_base="$@" 1.14 +command_args="$@" 1.15 1.16 usage() { 1.17 - echo "usage: $0 [-q|--quiet] [-v|--verbose] [--] <command> [repo_base_path]" > ${status_output} 1.18 + echo "usage: $0 [-q|--quiet] [-v|--verbose] [--] <command> [commands...]" > ${status_output} 1.19 exit 1 1.20 } 1.21 1.22 @@ -113,26 +113,30 @@ 1.23 pull_default="" 1.24 repos="" 1.25 repos_extra="" 1.26 -if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then 1.27 - if [ -f .hg/hgrc ] ; then 1.28 - pull_default=`hg paths default` 1.29 - if [ "${pull_default}" = "" ] ; then 1.30 - echo "ERROR: Need initial clone with 'hg paths default' defined" > ${status_output} 1.31 - exit 1 1.32 - fi 1.33 - fi 1.34 - if [ "${pull_default}" = "" ] ; then 1.35 +if [ "${command}" = "clone" -o "${command}" = "fclone" -o "${command}" = "tclone" ] ; then 1.36 + if [ ! -f .hg/hgrc ] ; then 1.37 echo "ERROR: Need initial repository to use this script" > ${status_output} 1.38 exit 1 1.39 fi 1.40 + 1.41 + pull_default=`hg paths default` 1.42 + if [ "${pull_default}" = "" ] ; then 1.43 + echo "ERROR: Need initial clone with 'hg paths default' defined" > ${status_output} 1.44 + exit 1 1.45 + fi 1.46 + 1.47 for i in ${subrepos} ; do 1.48 if [ ! -f ${i}/.hg/hgrc ] ; then 1.49 repos="${repos} ${i}" 1.50 fi 1.51 done 1.52 - if [ "${repo_base}" != "" ] ; then 1.53 + if [ "${command_args}" != "" ] ; then 1.54 pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'` 1.55 - pull_extra="${repo_base}/${pull_default_tail}" 1.56 + if [ "x${pull_default}" = "x${pull_default_tail}" ] ; then 1.57 + echo "ERROR: Need initial clone from non-local source" > ${status_output} 1.58 + exit 1 1.59 + fi 1.60 + pull_extra="${command_args}/${pull_default_tail}" 1.61 for i in ${subrepos_extra} ; do 1.62 if [ ! -f ${i}/.hg/hgrc ] ; then 1.63 repos_extra="${repos_extra} ${i}" 1.64 @@ -214,9 +218,8 @@ 1.65 done 1.66 ( 1.67 ( 1.68 - if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then 1.69 + if [ "${command}" = "clone" -o "${command}" = "fclone" -o "${command}" = "tclone" ] ; then 1.70 pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`" 1.71 - echo "hg clone ${pull_newrepo} ${i}" > ${status_output} 1.72 path="`dirname ${i}`" 1.73 if [ "${path}" != "." ] ; then 1.74 times=0 1.75 @@ -229,10 +232,11 @@ 1.76 sleep 5 1.77 done 1.78 fi 1.79 + echo "hg clone ${pull_newrepo} ${i}" > ${status_output} 1.80 (PYTHONUNBUFFERED=true hg${global_opts} clone ${pull_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 & 1.81 else 1.82 - echo "cd ${i} && hg${global_opts} ${command} ${repo_base}" > ${status_output} 1.83 - cd ${i} && (PYTHONUNBUFFERED=true hg${global_opts} ${command} ${command_repo}; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 & 1.84 + echo "cd ${i} && hg${global_opts} ${command} ${command_args}" > ${status_output} 1.85 + cd ${i} && (PYTHONUNBUFFERED=true hg${global_opts} ${command} ${command_args}; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 & 1.86 fi 1.87 1.88 echo $! > ${tmp}/${repopidfile}.pid