# HG changeset patch # User Yuya Nishihara # Date 1510400155 -32400 # Node ID 22767a1e61acff3521c0b84589546906274cdbcf # Parent 32e8d51ec16c7e8899797d2e7cd9b2995f364499 client: make it robust for weird repository path diff -r 32e8d51ec16c -r 22767a1e61ac hglib/client.py --- a/hglib/client.py Sat Nov 11 19:52:48 2017 +0900 +++ b/hglib/client.py Sat Nov 11 20:35:55 2017 +0900 @@ -46,8 +46,16 @@ self._args = [hglib.HGPATH, 'serve', '--cmdserver', 'pipe', '--config', 'ui.interactive=True'] if path: - self._args += ['-R', path] + # perhaps path shouldn't be a unicode string, but accepted for + # backward compatibility. + if isinstance(path, str): + # py2: bytes + bytes, py3: unicode + unicode + self._args += ['-R' + path] + else: + # py2: (ascii) bytes + unicode, py3: bytes + bytes + self._args += [b('-R') + path] if configs: + # don't use "--config=" form for hg 1.9 compatibility for config in configs: self._args += ['--config', config] self._env = {'HGPLAIN': '1'}