changeset 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 e2579eeb06ba
children 226d1ac6acb6
files .shell.d/50.vcs_functions.sh
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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`