mercurial/util.py
changeset 15076 89d9f92f6fdd
parent 15067 cc16323e748d
child 15081 d30ec2d16c5a
--- 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)