comparison hg2cl @ 14:edfb5738a86a

Simplify how running directory is determined.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 18 Sep 2011 14:23:40 +0300
parents 25d3461d9f2f
children 4dafb2835e21
comparison
equal deleted inserted replaced
13:25d3461d9f2f 14:edfb5738a86a
117 echo "No Mercurial repository found from this directory." 117 echo "No Mercurial repository found from this directory."
118 exit 2 118 exit 2
119 fi 119 fi
120 120
121 # find the directory that this script resides in 121 # find the directory that this script resides in
122 prog="$0" 122 dir=`dirname "$0"`
123 while test -h "$prog"; do 123 dir=`cd "$dir" && pwd`
124 prog=`ls -ld "$prog" | sed "s/^.*-> \(.*\)/\1/;/^[^/]/s,^,$(dirname "$prog")/,"`
125 done
126 dir=`dirname $prog`
127 dir=`cd $dir && pwd`
128 XSL="$dir/svn2cl.xsl" 124 XSL="$dir/svn2cl.xsl"
129 125
130 # redirect stdout to the changelog file if needed 126 # redirect stdout to the changelog file if needed
131 if test "x$CHANGELOG" != "x-"; then 127 if test "x$CHANGELOG" != "x-"; then
132 exec > "$CHANGELOG" 128 exec > "$CHANGELOG"