[PATCH 1 of 5] py3: remove use of str() in hgwebdir
Yuya Nishihara
yuya at tcha.org
Wed Sep 27 12:34:38 UTC 2017
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1506506672 -32400
# Wed Sep 27 19:04:32 2017 +0900
# Node ID b27593faa8b3d4ddcf71dcb323ae8189691929df
# Parent bf17b694881c47015c02f006a788b469c399f3eb
py3: remove use of str() in hgwebdir
'%d' can't be used here since port may be either integer or byte string.
diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -34,6 +34,7 @@ from .. import (
error,
hg,
profiling,
+ pycompat,
scmutil,
templater,
ui as uimod,
@@ -106,7 +107,7 @@ def geturlcgivars(baseurl, port):
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 @@ class hgwebdir(object):
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 + '/'
diff --git a/tests/test-doctest.py b/tests/test-doctest.py
--- a/tests/test-doctest.py
+++ b/tests/test-doctest.py
@@ -53,7 +53,7 @@ testmod('mercurial.dispatch')
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')
More information about the Mercurial-devel
mailing list