Mercurial > index.cgi > dotfiles
changeset 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 | 9982261aab86 |
children | 35386d23b884 |
files | .bash_aliases |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 }