[PATCH 3 of 3 hglib] client: make it robust for weird repository path
Yuya Nishihara
yuya at tcha.org
Sat Nov 11 06:41:32 EST 2017
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1510400155 -32400
# Sat Nov 11 20:35:55 2017 +0900
# Node ID 56b442f108be3ef960a60805e10ccda003e96bfb
# Parent cd73c3ee469e22216fbb9116701eed7059c1833c
client: make it robust for weird repository path
diff --git a/hglib/client.py b/hglib/client.py
--- a/hglib/client.py
+++ b/hglib/client.py
@@ -46,8 +46,16 @@ class hgclient(object):
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=<value>" form for hg 1.9 compatibility
for config in configs:
self._args += ['--config', config]
self._env = {'HGPLAIN': '1'}
More information about the Mercurial-devel
mailing list