comparison hglib/client.py @ 194:22767a1e61ac

client: make it robust for weird repository path
author Yuya Nishihara <yuya@tcha.org>
date Sat, 11 Nov 2017 20:35:55 +0900
parents 7a84a8656679
children 7c37f08d303d
comparison
equal deleted inserted replaced
193:32e8d51ec16c 194:22767a1e61ac
44 44
45 def __init__(self, path, encoding, configs, connect=True): 45 def __init__(self, path, encoding, configs, connect=True):
46 self._args = [hglib.HGPATH, 'serve', '--cmdserver', 'pipe', 46 self._args = [hglib.HGPATH, 'serve', '--cmdserver', 'pipe',
47 '--config', 'ui.interactive=True'] 47 '--config', 'ui.interactive=True']
48 if path: 48 if path:
49 self._args += ['-R', path] 49 # perhaps path shouldn't be a unicode string, but accepted for
50 # backward compatibility.
51 if isinstance(path, str):
52 # py2: bytes + bytes, py3: unicode + unicode
53 self._args += ['-R' + path]
54 else:
55 # py2: (ascii) bytes + unicode, py3: bytes + bytes
56 self._args += [b('-R') + path]
50 if configs: 57 if configs:
58 # don't use "--config=<value>" form for hg 1.9 compatibility
51 for config in configs: 59 for config in configs:
52 self._args += ['--config', config] 60 self._args += ['--config', config]
53 self._env = {'HGPLAIN': '1'} 61 self._env = {'HGPLAIN': '1'}
54 if encoding: 62 if encoding:
55 self._env['HGENCODING'] = encoding 63 self._env['HGENCODING'] = encoding