# HG changeset patch # User Augie Fackler # Date 1272865719 18000 # Node ID 9e45ac5350fd6786eca362e9b1891c627eef7a68 # Parent e2579eeb06ba01cd40d5abcb5f3c873fccdd6677 vcs funcs: tools for verifying hg or git repos, packing git repos diff --git a/.shell.d/50.vcs_functions.sh b/.shell.d/50.vcs_functions.sh --- a/.shell.d/50.vcs_functions.sh +++ b/.shell.d/50.vcs_functions.sh @@ -88,6 +88,14 @@ function hgamend() { } alias hg-amend=hgamend +function hg_verify_all() { + for x in $(find . -name '.hg') ; do + y=$(dirname $x) + echo $y + hg verify -R $y + done +} + function hgsvnmkbranch() { local upstream upstream=$(hg paths default | sed 's%/*$%%') @@ -212,6 +220,29 @@ function git_next_unmerged_file() { } alias git-next-unmerged-file=git_next_unmerged_file +function git_repack_all() { + for repo in $(find . | \ + grep '/objects/pack/' | \ + sed -e 's%\.git/objects/pack/.*%%' | \ + sed -e 's%git/objects/pack/.*%git%' | sort | uniq) ; do + pushd $repo + git repack -ad --window 100 + git gc --prune="`date`" + popd + done +} + +function git_fsck_all() { + for repo in $(find . | \ + grep '/objects/pack/' | \ + sed -e 's%\.git/objects/pack/.*%%' | \ + sed -e 's%git/objects/pack/.*%git%' | sort | uniq) ; do + pushd $repo + git fsck + popd + done +} + # change to the root dir of the current wc function wcroot() { local root=`hg root 2> /dev/null`