comparison .shell.d/50.vcs_functions.sh @ 204:9e45ac5350fd

vcs funcs: tools for verifying hg or git repos, packing git repos
author Augie Fackler <durin42@gmail.com>
date Mon, 03 May 2010 00:48:39 -0500
parents a563c21235ad
children 0590f34b92a0
comparison
equal deleted inserted replaced
203:e2579eeb06ba 204:9e45ac5350fd
85 85
86 function hgamend() { 86 function hgamend() {
87 hg qimport -r . && hg qref && hg qfin qtip 87 hg qimport -r . && hg qref && hg qfin qtip
88 } 88 }
89 alias hg-amend=hgamend 89 alias hg-amend=hgamend
90
91 function hg_verify_all() {
92 for x in $(find . -name '.hg') ; do
93 y=$(dirname $x)
94 echo $y
95 hg verify -R $y
96 done
97 }
90 98
91 function hgsvnmkbranch() { 99 function hgsvnmkbranch() {
92 local upstream 100 local upstream
93 upstream=$(hg paths default | sed 's%/*$%%') 101 upstream=$(hg paths default | sed 's%/*$%%')
94 local branchname 102 local branchname
210 function git_next_unmerged_file() { 218 function git_next_unmerged_file() {
211 git status | egrep '(unmerged|both modified)' | head -n 1 | sed 's/.*: //' 219 git status | egrep '(unmerged|both modified)' | head -n 1 | sed 's/.*: //'
212 } 220 }
213 alias git-next-unmerged-file=git_next_unmerged_file 221 alias git-next-unmerged-file=git_next_unmerged_file
214 222
223 function git_repack_all() {
224 for repo in $(find . | \
225 grep '/objects/pack/' | \
226 sed -e 's%\.git/objects/pack/.*%%' | \
227 sed -e 's%git/objects/pack/.*%git%' | sort | uniq) ; do
228 pushd $repo
229 git repack -ad --window 100
230 git gc --prune="`date`"
231 popd
232 done
233 }
234
235 function git_fsck_all() {
236 for repo in $(find . | \
237 grep '/objects/pack/' | \
238 sed -e 's%\.git/objects/pack/.*%%' | \
239 sed -e 's%git/objects/pack/.*%git%' | sort | uniq) ; do
240 pushd $repo
241 git fsck
242 popd
243 done
244 }
245
215 # change to the root dir of the current wc 246 # change to the root dir of the current wc
216 function wcroot() { 247 function wcroot() {
217 local root=`hg root 2> /dev/null` 248 local root=`hg root 2> /dev/null`
218 if [ x$root != 'x' ] ; then 249 if [ x$root != 'x' ] ; then
219 cd $root 250 cd $root