##// END OF EJS Templates
mercurial: fix some bytes usage
super-admin -
r1049:7b409ede python3
parent child Browse files
Show More
@@ -27,7 +27,7 b' import mercurial.hgweb.hgweb_mod'
27 import webob.exc
27 import webob.exc
28
28
29 from vcsserver import pygrack, exceptions, settings, git_lfs
29 from vcsserver import pygrack, exceptions, settings, git_lfs
30 from vcsserver.utils import ascii_bytes
30 from vcsserver.utils import ascii_bytes, safe_bytes
31
31
32 log = logging.getLogger(__name__)
32 log = logging.getLogger(__name__)
33
33
@@ -115,7 +115,10 b' def make_hg_ui_from_config(repo_config):'
115 baseui._tcfg = mercurial.config.config()
115 baseui._tcfg = mercurial.config.config()
116
116
117 for section, option, value in repo_config:
117 for section, option, value in repo_config:
118 baseui.setconfig(ascii_bytes(section), ascii_bytes(option), ascii_bytes(value))
118 baseui.setconfig(
119 ascii_bytes(section, allow_bytes=True),
120 ascii_bytes(option, allow_bytes=True),
121 ascii_bytes(value, allow_bytes=True))
119
122
120 # make our hgweb quiet so it doesn't print output
123 # make our hgweb quiet so it doesn't print output
121 baseui.setconfig(b'ui', b'quiet', b'true')
124 baseui.setconfig(b'ui', b'quiet', b'true')
@@ -131,11 +134,14 b' def update_hg_ui_from_hgrc(baseui, repo_'
131 return
134 return
132 log.debug('reading hgrc from %s', path)
135 log.debug('reading hgrc from %s', path)
133 cfg = mercurial.config.config()
136 cfg = mercurial.config.config()
134 cfg.read(path)
137 cfg.read(ascii_bytes(path))
135 for section in HG_UI_SECTIONS:
138 for section in HG_UI_SECTIONS:
136 for k, v in cfg.items(section):
139 for k, v in cfg.items(section):
137 log.debug('settings ui from file: [%s] %s=%s', section, k, v)
140 log.debug('settings ui from file: [%s] %s=%s', section, k, v)
138 baseui.setconfig(ascii_bytes(section), ascii_bytes(k), ascii_bytes(v))
141 baseui.setconfig(
142 ascii_bytes(section, allow_bytes=True),
143 ascii_bytes(k, allow_bytes=True),
144 ascii_bytes(v, allow_bytes=True))
139
145
140
146
141 def create_hg_wsgi_app(repo_path, repo_name, config):
147 def create_hg_wsgi_app(repo_path, repo_name, config):
@@ -151,7 +157,7 b' def create_hg_wsgi_app(repo_path, repo_n'
151 update_hg_ui_from_hgrc(baseui, repo_path)
157 update_hg_ui_from_hgrc(baseui, repo_path)
152
158
153 try:
159 try:
154 return HgWeb(repo_path, name=repo_name, baseui=baseui)
160 return HgWeb(safe_bytes(repo_path), name=safe_bytes(repo_name), baseui=baseui)
155 except mercurial.error.RequirementError as e:
161 except mercurial.error.RequirementError as e:
156 raise exceptions.RequirementException(e)(e)
162 raise exceptions.RequirementException(e)(e)
157
163
General Comments 0
You need to be logged in to leave comments. Login now