comparison .bash_overrides @ 414:41c3ea0a3513

make hg safer, again
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 04 Aug 2013 23:08:18 -0700
parents 337984b6af92
children 32b202653753
comparison
equal deleted inserted replaced
413:337984b6af92 414:41c3ea0a3513
95 COMMAND="`which find` -L \"$DIR\" -not -path '*.svn*' $@" 95 COMMAND="`which find` -L \"$DIR\" -not -path '*.svn*' $@"
96 #echo $COMMAND # for debugging 96 #echo $COMMAND # for debugging
97 `which find` -L "$DIR" -not -path '*.svn*' "$@" 97 `which find` -L "$DIR" -not -path '*.svn*' "$@"
98 } 98 }
99 99
100 # make hg safer since $HOME is versioned
100 function hg { 101 function hg {
101 if [[ "$(command hg root)" == "${HOME}" ]] 102 if [[ "$(command hg root)" == "${HOME}" ]]
102 then 103 then
103 if [[ "$*" == st* ]] 104 if [[ "$*" == st* ]]
104 then 105 then
105 command hg st -q 106 command hg st -q
106 return 107 return
107 fi 108 fi
108 if [[ "$*" == res* ]] || [[ "$*" == pu* ]] 109 if [[ "$*" == res* ]] || [[ "$*" == pur* ]]
109 then 110 then
110 echo "Aborting \'hg $*\'; hg root is ${HOME}!" 111 echo "Aborting \'hg $*\'; hg root is ${HOME}!"
111 return 1 112 return 1
112 fi 113 fi
114 command hg "$@"
113 fi 115 fi
114 } 116 }
115 117
116 function lsdiff { 118 function lsdiff {
117 # TODO: extract this general pattern as a bash "decorator" 119 # TODO: extract this general pattern as a bash "decorator"