# HG changeset patch # User Bryan O'Sullivan # Date 1123706125 28800 # Node ID 16ce690c411d56736fde9fcfaac009c3bf999aff # Parent 6390c377a9e617e01061d33f3729948d72b6f54f Fix problem with "hg serve" on systems not providing IPv6. diff --git a/mercurial/hgweb.py b/mercurial/hgweb.py --- a/mercurial/hgweb.py +++ b/mercurial/hgweb.py @@ -708,7 +708,12 @@ def create_server(path, name, templates, import BaseHTTPServer class IPv6HTTPServer(BaseHTTPServer.HTTPServer): - address_family = socket.AF_INET6 + address_family = getattr(socket, 'AF_INET6', None) + + def __init__(self, *args, **kwargs): + if self.address_family is None: + raise RepoError('IPv6 not available on this system') + BaseHTTPServer.HTTPServer.__init__(self, *args, **kwargs) class hgwebhandler(BaseHTTPServer.BaseHTTPRequestHandler): def log_error(self, format, *args):