test-setdiscovery.t: portability fix
The output of 'wc -c' is prefixed with spaces when using BSD wc.
url: Remove the proxy env variables only when needed (
issue2451)
This is an attempt to fix issue 2451 and its duplicates (2599 and 2949, AFAIK).
Its main idea is that it is only necessary to clean the proxy environment
variables *when* http_proxy is set in the config file (since it takes
precedence over the environment variables). Otherwise, hg shouldn't bother with
them, since they will most likely be used to reach the server.
util: improve finding of hgexecutable
check the module __main__ before looking on the default path