changeset 1041:d6f66566d8b3

8042417: hgforest: allow local clone of extra repos Reviewed-by: chegar, erikj
author mduigou
date Tue, 06 May 2014 13:24:51 -0700
parents ccbabea88c1c
children 5800456add07
files common/bin/hgforest.sh
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/common/bin/hgforest.sh	Tue May 06 11:43:14 2014 +0200
+++ b/common/bin/hgforest.sh	Tue May 06 13:24:51 2014 -0700
@@ -144,8 +144,10 @@
       repos="${repos} ${i}"
     fi
   done
+
+  pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'`
+
   if [ "${command_args}" != "" ] ; then
-    pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'`
     if [ "x${pull_default}" = "x${pull_default_tail}" ] ; then
       echo "ERROR: Need initial clone from non-local source" > ${status_output}
       exit 1
@@ -156,6 +158,16 @@
         repos_extra="${repos_extra} ${i}"
       fi
     done
+  else
+    if [ "x${pull_default}" = "x${pull_default_tail}" ] ; then
+      # local source repo. Copy the extras ones that exist there.
+      for i in ${subrepos_extra} ; do
+        if [ -f ${pull_default}/${i}/.hg/hgrc -a ! -f ${i}/.hg/hgrc ] ; then
+          # sub-repo there in source but not here
+          repos_extra="${repos_extra} ${i}"
+        fi
+      done
+    fi
   fi
   at_a_time=2
   # Any repos to deal with?