# HG changeset patch # User Steve Huston # Date 1430861795 14400 # Node ID 4b397e94691accc27c79181f595b0038e0edbc65 # Parent 9982261aab86c9094e572f83867a5bc76af8ff15 Why didn't I know 'hg root' existed.. much cleaner. diff -r 9982261aab86 -r 4b397e94691a .bash_aliases --- a/.bash_aliases Tue Apr 21 13:15:14 2015 -0400 +++ b/.bash_aliases Tue May 05 17:36:35 2015 -0400 @@ -249,15 +249,16 @@ hgs() { # Currently works on Macs, I should write a version for Linux as well # someday - if [ "$1" == "end" -a -e .hgserve-PID ] ; then - kill `cat .hgserve-PID` - rm .hgserve-PID - elif [ -e .hgserve-PID ] ; then - P=`cat .hgserve-PID` + ROOT=`hg root` + if [ "$1" == "end" -a -e $ROOT/.hg/hgserve-PID ] ; then + kill `cat $ROOT/.hg/hgserve-PID` + rm $ROOT/.hg/hgserve-PID + elif [ -e $ROOT/.hg/hgserve-PID ] ; then + P=`cat $ROOT/.hg/hgserve-PID` URL=`lsof -p $P | grep LISTEN | awk '{print $9}'` open http://$URL/ else - hg serve -a localhost -d -p 0 --pid-file .hgserve-PID | sed 's#.*bound to \(.*\))#http://\1/#' | xargs open + hg serve -a localhost -d -p 0 --pid-file $ROOT/.hg/hgserve-PID | sed 's#.*bound to \(.*\))#http://\1/#' | xargs open fi }