comparison .bash_aliases @ 128:4b397e94691a

Why didn't I know 'hg root' existed.. much cleaner.
author Steve Huston <huston@astro.princeton.edu>
date Tue, 05 May 2015 17:36:35 -0400
parents 28c2ddd02e8f
children dead87cd99ae
comparison
equal deleted inserted replaced
127:9982261aab86 128:4b397e94691a
247 } 247 }
248 248
249 hgs() { 249 hgs() {
250 # Currently works on Macs, I should write a version for Linux as well 250 # Currently works on Macs, I should write a version for Linux as well
251 # someday 251 # someday
252 if [ "$1" == "end" -a -e .hgserve-PID ] ; then 252 ROOT=`hg root`
253 kill `cat .hgserve-PID` 253 if [ "$1" == "end" -a -e $ROOT/.hg/hgserve-PID ] ; then
254 rm .hgserve-PID 254 kill `cat $ROOT/.hg/hgserve-PID`
255 elif [ -e .hgserve-PID ] ; then 255 rm $ROOT/.hg/hgserve-PID
256 P=`cat .hgserve-PID` 256 elif [ -e $ROOT/.hg/hgserve-PID ] ; then
257 P=`cat $ROOT/.hg/hgserve-PID`
257 URL=`lsof -p $P | grep LISTEN | awk '{print $9}'` 258 URL=`lsof -p $P | grep LISTEN | awk '{print $9}'`
258 open http://$URL/ 259 open http://$URL/
259 else 260 else
260 hg serve -a localhost -d -p 0 --pid-file .hgserve-PID | sed 's#.*bound to \(.*\))#http://\1/#' | xargs open 261 hg serve -a localhost -d -p 0 --pid-file $ROOT/.hg/hgserve-PID | sed 's#.*bound to \(.*\))#http://\1/#' | xargs open
261 fi 262 fi
262 } 263 }
263 264
264 # vim: set filetype=sh : 265 # vim: set filetype=sh :