comparison .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
comparison
equal deleted inserted replaced
183:fe810e9731f0 184:efa2bfc73d2d
123 } 123 }
124 124
125 # Function to update source trees of known VCS tools in the working dir. 125 # Function to update source trees of known VCS tools in the working dir.
126 # "known" means ones I'm forced to use on a regular basis 126 # "known" means ones I'm forced to use on a regular basis
127 function update_source_trees() { 127 function update_source_trees() {
128 if ! ls -l | egrep ^d > /dev/null ; then
129 ls -l | egrep ^d
130 return
131 fi
132 local hgpath
128 for aa in */ ; do 133 for aa in */ ; do
129 pushd $aa > /dev/null || continue 134 pushd $aa > /dev/null || continue
130 if [ -e .svn ] ; then 135 if [ -e .svn ] ; then
131 echo $aa 'is an svn checkout, updating' 136 echo $aa 'is an svn checkout, updating'
132 svn up 137 svn up
138 echo "$aa looks like an svnsync clone, syncing" 143 echo "$aa looks like an svnsync clone, syncing"
139 svnsync sync file://$(pwd) 144 svnsync sync file://$(pwd)
140 elif [ -e .git/svn ] ; then 145 elif [ -e .git/svn ] ; then
141 echo $aa 'is a git-svn checkout, updating' 146 echo $aa 'is a git-svn checkout, updating'
142 git svn fetch 147 git svn fetch
143 git repack
144 git gc
145 elif [ -e .git ] ; then 148 elif [ -e .git ] ; then
146 echo $aa 'is a git checkout, updating' 149 echo $aa 'is a git checkout, updating'
147 git pull origin master 150 git pull origin master
148 git repack
149 git gc
150 elif [ -e .hg ] ; then 151 elif [ -e .hg ] ; then
151 echo $aa 'is an hg checkout, updating' && hg pull && hg up 152 echo $aa 'is an hg checkout, updating'
153 for hgpath in $(HGRCPATH=/dev/null hg paths | sed 's/.* = //g' | sort | uniq ) ; do
154 hg pull --update $hgpath
155 done
152 if [ -e .hg/patches/.hg ] ; then 156 if [ -e .hg/patches/.hg ] ; then
153 echo $aa 'has an mq, updating that too...' 157 echo $aa 'has an mq, updating that too...'
154 hg -R .hg/patches pull -u 158 hg -R .hg/patches pull -u
155 fi 159 fi
156 elif [ -e _MTN ] ; then 160 elif [ -e _MTN ] ; then
157 echo $aa "is an mtn co, updating" && mtn pull && mtn up 161 echo $aa "is an mtn co, updating" && mtn pull && mtn up
162 else
163 update_source_trees
158 fi 164 fi
159 popd > /dev/null 165 popd > /dev/null
160 done 166 done
161 } 167 }
162 alias update-source-trees=update_source_trees 168 alias update-source-trees=update_source_trees