py3: Use import argument paths as bytestrings
@@ -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)
