Mercurial > index.cgi > dotfiles
comparison .bash_aliases @ 154:cfbaaeb8b71d
This makes 'hgs' work nicer on Linux, still may be more tweaks to do
author | Steve Huston <huston@astro.princeton.edu> |
---|---|
date | Mon, 10 Apr 2017 15:31:48 -0400 |
parents | 4cd1f5ebaaa9 |
children | 5ab127dd2d89 |
comparison
equal
deleted
inserted
replaced
153:1dc2b14d4f02 | 154:cfbaaeb8b71d |
---|---|
244 done | 244 done |
245 echo Files stored in $OUTDIR | 245 echo Files stored in $OUTDIR |
246 } | 246 } |
247 | 247 |
248 hgs() { | 248 hgs() { |
249 # Currently works on Macs, I should write a version for Linux as well | 249 # We assume here that if the host is a Mac, we're going to open the |
250 # someday | 250 # connection automatically, otherwise we echo the URL to the terminal to be |
251 # opened | |
251 ROOT=`hg root` | 252 ROOT=`hg root` |
252 if [ "$1" == "end" -a -e $ROOT/.hg/hgserve-PID ] ; then | 253 if [ "$1" == "end" -a -e $ROOT/.hg/hgserve-PID ] ; then |
253 kill `cat $ROOT/.hg/hgserve-PID` | 254 kill `cat $ROOT/.hg/hgserve-PID` |
254 rm $ROOT/.hg/hgserve-PID | 255 rm $ROOT/.hg/hgserve-PID |
255 elif [ -e $ROOT/.hg/hgserve-PID ] ; then | |
256 P=`cat $ROOT/.hg/hgserve-PID` | |
257 URL=`lsof -p $P | grep LISTEN | awk '{print $9}'` | |
258 open http://$URL/ | |
259 else | 256 else |
260 hg serve -a localhost -d -p 0 --pid-file $ROOT/.hg/hgserve-PID | sed 's#.*bound to \(.*\))#http://\1/#' | xargs open | 257 if [ -e $ROOT/.hg/hgserve-PID ] ; then |
258 P=`cat $ROOT/.hg/hgserve-PID` | |
259 URL=`lsof -n -p $P | grep LISTEN | awk '{print $9}'` | |
260 else | |
261 URL=`hg serve -a localhost -d -p 0 --pid-file $ROOT/.hg/hgserve-PID | sed 's#.*bound to \(.*\))#\1#'` | |
262 fi | |
263 if [ -z "$DARWIN" ] ; then | |
264 echo hg serve on http://$URL/ | |
265 else | |
266 open http://$URL/ | |
267 fi | |
261 fi | 268 fi |
262 } | 269 } |
263 | 270 |
264 # vim: set filetype=sh : | 271 # vim: set filetype=sh : |