py3: Use import argument paths as bytestrings

This commit is contained in:
Adrian Sampson 2018-01-30 21:52:31 -05:00
parent 9577a511cb
commit 2f2388fc2c

View file

@ -934,6 +934,13 @@ def import_func(lib, opts, args):
if not paths:
raise ui.UserError(u'no path specified')
# On Python 2, we get filenames as raw bytes, which is what we
# need. On Python 3, we need to undo the "helpful" conversion to
# Unicode strings to get the real bytestring filename.
if not six.PY2:
paths = [p.encode(util.arg_encoding(), 'surrogateescape')
for p in paths]
import_files(lib, paths, query)