diff .shell.d/50.vcs_functions.sh @ 184:efa2bfc73d2d

update-source-trees: recurse to find all VCS working copies
author Augie Fackler <durin42@gmail.com>
date Tue, 26 Jan 2010 11:48:39 -0600
parents 040ac89ffe1e
children e1a49db5c6ff
line wrap: on
line diff
--- a/.shell.d/50.vcs_functions.sh
+++ b/.shell.d/50.vcs_functions.sh
@@ -125,6 +125,11 @@ function clean_svn_source_trees() {
 # Function to update source trees of known VCS tools in the working dir.
 # "known" means ones I'm forced to use on a regular basis
 function update_source_trees() {
+    if ! ls -l | egrep ^d > /dev/null ; then
+        ls -l | egrep ^d
+        return
+    fi
+    local hgpath
     for aa in */ ; do
         pushd $aa > /dev/null || continue
         if [ -e .svn ] ; then
@@ -140,21 +145,22 @@ function update_source_trees() {
         elif [ -e .git/svn ] ; then
             echo $aa 'is a git-svn checkout, updating'
             git svn fetch
-            git repack
-            git gc
         elif [ -e .git ] ; then
             echo $aa 'is a git checkout, updating'
             git pull origin master
-            git repack
-            git gc
         elif [ -e .hg ] ; then
-            echo $aa 'is an hg checkout, updating' && hg pull && hg up
+            echo $aa 'is an hg checkout, updating'
+            for hgpath in $(HGRCPATH=/dev/null hg paths | sed 's/.* = //g' | sort | uniq ) ; do
+                hg pull --update $hgpath
+            done
             if [ -e .hg/patches/.hg ] ; then
                echo $aa 'has an mq, updating that too...'
                hg -R .hg/patches pull -u
             fi
         elif [ -e _MTN ] ; then
             echo $aa "is an mtn co, updating" && mtn pull && mtn up
+        else
+            update_source_trees
         fi
         popd > /dev/null
     done