28 pull_extra_base="$2" |
28 pull_extra_base="$2" |
29 |
29 |
30 # Python always buffers stdout significantly, thus we will not see any output from hg clone jdk, |
30 # Python always buffers stdout significantly, thus we will not see any output from hg clone jdk, |
31 # until a lot of time has passed! By passing -u to python, we get incremental updates |
31 # until a lot of time has passed! By passing -u to python, we get incremental updates |
32 # on stdout. Much nicer. |
32 # on stdout. Much nicer. |
33 whichhg="`which hg`" |
33 whichhg="`which hg 2> /dev/null | grep -v '^no hg in'`" |
34 |
34 |
35 if [ "${whichhg}" = "" ] ; then |
35 if [ "${whichhg}" = "" ] ; then |
36 echo Cannot find hg! |
36 echo Cannot find hg! |
37 exit 1 |
37 exit 1 |
38 fi |
38 fi |
49 if [ "#!" = "$has_hash_bang" ] ; then |
49 if [ "#!" = "$has_hash_bang" ] ; then |
50 python="`head -n 1 ${whichhg} | cut -b 3-`" |
50 python="`head -n 1 ${whichhg} | cut -b 3-`" |
51 bpython="`basename "$python"`" |
51 bpython="`basename "$python"`" |
52 fi |
52 fi |
53 |
53 |
54 if [ "python" = "$bpython" -a -x "$python" ] ; then |
54 if [ -x "$python" -a ! -d "$python" -a "`${python} -V 2>&1 | cut -f 1 -d ' '`" = "Python" ] ; then |
55 hg="${python} -u ${whichhg}" |
55 hg="${python} -u ${whichhg}" |
56 else |
56 else |
57 echo Cannot find python from hg launcher. Running plain hg, which probably has buffered stdout. |
57 echo Cannot find python from hg launcher. Running plain hg, which probably has buffered stdout. |
58 hg="hg" |
58 hg="hg" |
59 fi |
59 fi |