[PATCH] util: improve finding of hgexecutable
Mads Kiilerich
mads at kiilerich.com
Fri Aug 26 17:20:53 CDT 2011
On 08/27/2011 12:07 AM, Simon Heimberg wrote:
> # HG changeset patch
> # User Simon Heimberg<simohe at besonet.ch>
> # Date 1311394698 -7200
> # Node ID 52bfbbe8045e43d2c721bea236cbd3b049fbc1e7
> # Parent f5cf34c773591ad07a98f8892020e58a5c241139
> util: improve finding of hgexecutable
>
> check the module __main__ before looking on the default path
What problem will this solve?
It seems like this code in some cases if run from thg will try to use
thg as hg exeutable instead of trying to find hg in the path?
/Mads
> diff -r f5cf34c77359 -r 52bfbbe8045e mercurial/util.py
> --- a/mercurial/util.py Sam Aug 13 00:08:26 2011 +0200
> +++ b/mercurial/util.py Sam 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)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list