mercurial forest extension doesn't honor "http_proxy" environment variable

Volker Simonis volker.simonis at gmail.com
Mon Dec 17 05:58:14 PST 2007


Hi,

I just had a real hard time to get the forest extension working and
finally found out that it was because the forest extension doesn't
honor the  "http_proxy" environment variable. So I thought I'll post
it here in case anybody else will face the same problem in order to
save him some time. (If you're only interested in the solution of the
problem, you can skip the next paragraphs and jump right to the end of
this post).

I installed Mercurial and the forest extension as described in various
places, here on the list and on the Web - that was the easy part:)
Afterwards I could do:

/share/software/OpenJDK> hg clone http://hg.openjdk.java.net/jdk7/jdk7/ jdk7
requesting all changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 26 changes to 26 files
26 files updated, 0 files merged, 0 files removed, 0 files unresolved

So everything worked fine! Note that I'm behind a firewall, but
Mercurial correctly picked up my http proxy from the  "http_proxy"
environment variable!

But now, everytime I tried 'fclone', I got the following error:

/share/software/OpenJDK> hg fclone http://hg.openjdk.java.net/jdk7/jdk7/ jdk7
[.]
abort: error: Name or service not known

That was not amusing. First I thought I got something wrong during the
installation of the forest extension. I than used the '--traceback'
option to "hg" which told me that the error was  in keepalive.py:

/share/software/OpenJDK> hg --traceback fclone
http://hg.openjdk.java.net/jdk7/jdk7/ jdk7
[.]
Traceback (most recent call last):
...
File "/share/software/Python-2.5.1_bin/lib/python2.5/site-packages/mercurial/keepalive.py",
line 328, in _start_transaction
    raise urllib2.URLError(err)
URLError: <urlopen error (-2, 'Name or service not known')>
abort: error: Name or service not known

So I enabled the debugging output in keepalive.py and realized, that
the first two connections to hg.openjdk.java.net where made trough the
proxy, while the third one (the first that actually fetches files),
wants to go directly to hg.openjdk.java.net, which badly fails:

/share/software/OpenJDK> hg fclone http://hg.openjdk.java.net/jdk7/jdk7/ jdk7
keepalive.py -  creating new connection to proxy:8080 (1078835788)
keepalive.py -  STATUS: 200, OK
keepalive.py -  re-using connection to proxy:8080 (1078835788)
keepalive.py -  STATUS: 200, OK
[.]
keepalive.py -  creating new connection to hg.openjdk.java.net (1078970092)
abort: error: Name or service not known

The problem can be fixed by adding the proxy settings  to your .hgrc
file, like this:

[http_proxy]
host=proxy:8080

where you have to replace "proxy:8080" with the name and the port of
your real proxy host!

@Simon: I took your email address from Forest Extension Wiki page at
http://www.selenic.com/mercurial/wiki/index.cgi/ForestExtension where
you're listed as maintainer of the forest extension. Could you be so
kind to have a look at this problem and fix it if possible.

Regards,
Volker



More information about the build-dev mailing list