util: improve finding of hgexecutable
check the module __main__ before looking on the default path
--- a/mercurial/util.py Thu Sep 08 18:30:44 2011 -0500
+++ b/mercurial/util.py Sat Jul 23 06:18:18 2011 +0200
@@ -374,6 +374,8 @@
_sethgexecutable(hg)
elif mainfrozen():
_sethgexecutable(sys.executable)
+ elif getattr(sys.modules['__main__'], '__file__', '').endswith('hg'):
+ _sethgexecutable(sys.modules['__main__'].__file__)
else:
exe = findexe('hg') or os.path.basename(sys.argv[0])
_sethgexecutable(exe)