invalid ip addr on hg serve

Adrian Buehlmann adrian at cadifra.com
Mon Mar 31 11:59:19 CDT 2008


On 31.03.2008 18:26, Giorgos Keramidas wrote:
> On Mon, 31 Mar 2008 10:24:49 -0500, Matt Mackall <mpm at selenic.com> wrote:
>> Wow is this thread getting long without any progress. I'll gladly take a
>> patch to hide 0.0.0.0 as "*" or "".
> 
> Since this is a 'display' issue, does the following look ok?
> 
> %%%
> diff -r 0231f763ebc8 mercurial/commands.py

Here is mine:

'''
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2527,8 +2527,11 @@
             if port == ':80':
                 port = ''

-            ui.status(_('listening at http://%s%s/%s (%s:%d)\n') %
-                      (self.httpd.fqaddr, port, prefix, self.httpd.addr, self.httpd.port))
+            addr = self.httpd.addr
+            if addr == '0.0.0.0':
+                addr = '*'
+            ui.status(_('listening on address %s:%d (http://%s%s/%s)\n') %
+                      (addr, self.httpd.port, self.httpd.fqaddr, port, prefix))

         def run(self):
             self.httpd.serve_forever()
'''

Run on my WinXP box:

> hg serve -v -p 80
listening on address *:80 (http://snoopy/)

> hg serve -v -p 80 -a localhost
listening on address 127.0.0.1:80 (http://localhost/)

> hg serve -v
listening on address *:8000 (http://snoopy:8000/)



More information about the Mercurial mailing list