Mike,

hgforest still doesn't detect python because on my linux laptop hg
headline is

#!/usr/bin/env python

I'd attached the patch I use (regenerated against latest tl with 8024200
changes)

-Dmitry

On 2013-09-03 23:43, Mike Duigou wrote:
> Hello all;
> 
> This is a very small change to trim optional whitespace off of the 
> interpreter directive which may appear in the hg wrapper script. The 
> whitespace is legal per https://en.wikipedia.org/wiki/Shebang_%28Unix%29 and 
> is now included in some distributions of mercurial (Ubuntu 13.04).
> 
> http://cr.openjdk.java.net/~mduigou/JDK-8024200/0/webrev/
> 
> Mike
> 
> 


-- 
Dmitry Samersoff
Oracle Java development team, Saint Petersburg, Russia
* I would love to change the world, but they won't give me the sources.
diff -r 73355c4c1bc8 common/bin/hgforest.sh
--- a/common/bin/hgforest.sh    Fri Sep 06 14:15:02 2013 -0700
+++ b/common/bin/hgforest.sh    Wed Sep 11 17:50:57 2013 +0400
@@ -42,17 +42,13 @@
   exit 1
 fi
 
-has_hash_bang="`head -n 1 "${whichhg}" | cut -b 1-2`"
-python=""
-bpython=""
+hpython=`sed -n -e '1 s,^[^/]*/,/,p' ${whichhg}`
+python=`$hpython -c "import sys; print(sys.executable)"` 
+hg="${python} -u ${whichhg}"
 
-if [ "#!" = "$has_hash_bang" ] ; then
-   python="`head -n 1 ${whichhg} | cut -b 3- | sed -e 's/^[ \t]*//;s/[ 
\t]*$//'`"
-   bpython="`basename "$python"`"
-fi
-
-if [ -x "$python" -a ! -d "$python" -a "`${python} -V 2>&1 | cut -f 1 -d ' '`" 
= "Python" ] ; then
-  hg="${python} -u ${whichhg}"
+if ${hg} version | grep -q "Mercurial"
+then
+  echo "Using: ${hg}"
 else
   echo Cannot find python from hg launcher. Running plain hg, which probably 
has buffered stdout.
   hg="hg"

Reply via email to