changeset 34358: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 c41444a39de2
children ee10eb665036
files mercurial/hgweb/hgwebdir_mod.py tests/test-doctest.py
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
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 + '/'
--- a/tests/test-doctest.py	Wed Sep 27 18:07:48 2017 -0700
+++ b/tests/test-doctest.py	Wed Sep 27 19:04:32 2017 +0900
@@ -53,7 +53,7 @@
 testmod('mercurial.encoding')
 testmod('mercurial.formatter')
 testmod('mercurial.hg')
-testmod('mercurial.hgweb.hgwebdir_mod', py3=False)  # py3: repr(bytes) ?
+testmod('mercurial.hgweb.hgwebdir_mod')
 testmod('mercurial.match')
 testmod('mercurial.mdiff')
 testmod('mercurial.minirst')