diff mercurial/hgweb/hgwebdir_mod.py @ 34359:8cbcee0b923d

py3: remove use of str() in hgwebdir '%d' can't be used here since port may be either integer or byte string.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 27 Sep 2017 19:04:32 +0900
parents 2844c4bd5a39
children a57c938e7ac8
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py	Wed Sep 27 18:07:48 2017 -0700
+++ b/mercurial/hgweb/hgwebdir_mod.py	Wed Sep 27 19:04:32 2017 +0900
@@ -34,6 +34,7 @@
     error,
     hg,
     profiling,
+    pycompat,
     scmutil,
     templater,
     ui as uimod,
@@ -106,7 +107,7 @@
     if not path.startswith('/'):
         path = '/' + path
 
-    return name, str(port), path
+    return name, pycompat.bytestr(port), path
 
 class hgwebdir(object):
     """HTTP server for multiple repositories.
@@ -293,7 +294,7 @@
                         msg = encoding.strtolocal(inst.strerror)
                         raise ErrorResponse(HTTP_SERVER_ERROR, msg)
                     except error.RepoError as inst:
-                        raise ErrorResponse(HTTP_SERVER_ERROR, str(inst))
+                        raise ErrorResponse(HTTP_SERVER_ERROR, bytes(inst))
 
             # browse subdirectories
             subdir = virtual + '/'