hg serve fails on Cygwin

Bryan O'Sullivan bos at serpentine.com
Wed Aug 10 15:37:40 CDT 2005


On Wed, 2005-08-10 at 13:47 +0200, Michal Kvasnica wrote:

> after changeset 0108c602feb9dacc00b66647b8871bd9ee991b92
> 'hg serve' fails on Cygwin (Win XP + SP2):

Fix attached and pullable from http://www.serpentine.com/hg

# HG changeset patch
# User Bryan O'Sullivan <bos at serpentine.com>
# Node ID 16ce690c411d56736fde9fcfaac009c3bf999aff
# Parent  6390c377a9e617e01061d33f3729948d72b6f54f
Fix problem with "hg serve" on systems not providing IPv6.

diff -r 6390c377a9e6 -r 16ce690c411d mercurial/hgweb.py
--- a/mercurial/hgweb.py	Tue Aug  9 17:36:34 2005
+++ b/mercurial/hgweb.py	Wed Aug 10 20:35:25 2005
@@ -708,7 +708,12 @@
     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):




More information about the Mercurial mailing list