# HG changeset patch # User Nicolas Dumazet # Date 2009-09-21 17:21:32 # Node ID 16698d87ad20bba4118d45561800633d3451962b # Parent 1c34fca5d785ac725e7b482cfb48b65d2793e838 util: use sys.argv[0] if $HG is unset and 'hg' is not in PATH This is necessary when the executable name is not 'hg'. For example, if your system-wide mercurial is name 'hgs', sys.argv[0] is more accurate than 'hg'. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -335,7 +335,8 @@ def hgexecutable(): elif main_is_frozen(): set_hgexecutable(sys.executable) else: - set_hgexecutable(find_exe('hg') or 'hg') + exe = find_exe('hg') or os.path.basename(sys.argv[0]) + set_hgexecutable(exe) return _hgexecutable def set_hgexecutable(path):