changeset 15076:89d9f92f6fdd

util: improve finding of hgexecutable check the module __main__ before looking on the default path
author Simon Heimberg <simohe@besonet.ch>
date Sat, 23 Jul 2011 06:18:18 +0200
parents 91d2efecb245
children 193e7018dc8c
files mercurial/util.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)