diff -r 6ca5f825a0ca -r 9e6d3465f17e mercurial/url.py --- a/mercurial/url.py Sat Mar 24 14:24:32 2018 +0900 +++ b/mercurial/url.py Sat Mar 24 13:02:27 2018 +0900 @@ -12,6 +12,7 @@ import base64 import os import socket +import sys from .i18n import _ from . import ( @@ -304,6 +305,16 @@ keepalive.HTTPConnection.__init__(self, *args, **kwargs) self._create_connection = createconn + if sys.version_info < (2, 7, 7): + # copied from 2.7.14, since old implementations directly call + # socket.create_connection() + def connect(self): + self.sock = self._create_connection((self.host, self.port), + self.timeout, + self.source_address) + if self._tunnel_host: + self._tunnel() + class logginghttphandler(httphandler): """HTTP handler that logs socket I/O.""" def __init__(self, logfh, name, observeropts):