diff mercurial/hgweb/__init__.py @ 34704:c51380879054

hgweb: rewrite most obviously-native-strings to be native strings This clearly won't be everything, but it unblocks a fair amount of stuff here. Differential Revision: https://phab.mercurial-scm.org/D1079
author Augie Fackler <augie@google.com>
date Sat, 14 Oct 2017 15:42:38 -0400
parents add7bcad1d9c
children a8a902d7176e
line wrap: on
line diff
--- a/mercurial/hgweb/__init__.py	Thu Oct 05 14:48:52 2017 -0400
+++ b/mercurial/hgweb/__init__.py	Sat Oct 14 15:42:38 2017 -0400
@@ -14,6 +14,7 @@
 
 from .. import (
     error,
+    pycompat,
     util,
 )
 
@@ -61,25 +62,26 @@
         else:
             prefix = ''
 
-        port = ':%d' % self.httpd.port
-        if port == ':80':
-            port = ''
+        port = r':%d' % self.httpd.port
+        if port == r':80':
+            port = r''
 
         bindaddr = self.httpd.addr
-        if bindaddr == '0.0.0.0':
-            bindaddr = '*'
-        elif ':' in bindaddr: # IPv6
-            bindaddr = '[%s]' % bindaddr
+        if bindaddr == r'0.0.0.0':
+            bindaddr = r'*'
+        elif r':' in bindaddr: # IPv6
+            bindaddr = r'[%s]' % bindaddr
 
         fqaddr = self.httpd.fqaddr
-        if ':' in fqaddr:
-            fqaddr = '[%s]' % fqaddr
+        if r':' in fqaddr:
+            fqaddr = r'[%s]' % fqaddr
         if self.opts['port']:
             write = self.ui.status
         else:
             write = self.ui.write
         write(_('listening at http://%s%s/%s (bound to %s:%d)\n') %
-              (fqaddr, port, prefix, bindaddr, self.httpd.port))
+              (pycompat.sysbytes(fqaddr), pycompat.sysbytes(port),
+               prefix, pycompat.sysbytes(bindaddr), self.httpd.port))
         self.ui.flush()  # avoid buffering of status message
 
     def run(self):