Commit 5c7ea194 authored by Michal Čihař's avatar Michal Čihař

Fix Mercurial support in Python 3

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 42bbdb80
...@@ -760,13 +760,16 @@ class HgRepository(Repository): ...@@ -760,13 +760,16 @@ class HgRepository(Repository):
""" """
Reads entry from configuration. Reads entry from configuration.
""" """
result = None
section, option = path.split('.', 1) section, option = path.split('.', 1)
filename = os.path.join(self.path, '.hg', 'hgrc') filename = os.path.join(self.path, '.hg', 'hgrc')
config = RawConfigParser() config = RawConfigParser()
config.read(filename) config.read(filename)
if config.has_option(section, option): if config.has_option(section, option):
return config.get(section, option).decode('utf-8') result = config.get(section, option)
return None if six.PY2:
result = result.decode('utf-8')
return result
def set_config(self, path, value): def set_config(self, path, value):
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment