diff .bash_overrides @ 412:5bee5c55a7a0

args test + bash overrides hg safety
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 04 Aug 2013 22:59:52 -0700
parents 597455a28c49
children 337984b6af92
line wrap: on
line diff
--- a/.bash_overrides	Sun Aug 04 15:58:31 2013 -0700
+++ b/.bash_overrides	Sun Aug 04 22:59:52 2013 -0700
@@ -97,6 +97,21 @@
     `which find` -L "$DIR" -not -path '*.svn*' "$@"
 }
 
+function hg {
+    if [[ "$(hg root)" == "${HOME}" ]]
+    then
+        if [[ "$*" == st* ]]
+        then
+            command hg st -q
+            return
+        fi
+        if [[ "$*" == res* ]] || [[ "$*" == pu* ]]
+        then
+            echo "Aborting \'hg $*\'; hg root is ${HOME}!"
+        fi
+    fi
+}
+
 function lsdiff {
     # TODO: extract this general pattern as a bash "decorator"
     if expr "$1" : 'http[s]\?://.*' &> /dev/null