/breezy-debian/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy-debian/trunk

« back to all changes in this revision

Viewing changes to bzrtools_import.py

  • Committer: Jelmer Vernooij
  • Date: 2018-10-10 21:43:37 UTC
  • Revision ID: jelmer@jelmer.uk-20181010214337-ffmg6a8np2ywc67h
Python3 compatibility fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from ...errors import NoSuchFile, BzrCommandError, NotBranchError
19
19
from ...osutils import (pathjoin, isdir, file_iterator, basename,
20
20
                        file_kind, splitpath, normpath, walkdirs)
 
21
from ...sixish import StringIO
21
22
from ...trace import warning
22
23
from ...transform import TreeTransform, resolve_conflicts, cook_conflicts
23
24
from ...workingtree import WorkingTree
83
84
                yield FileInfo(self.root, relpath, stat_result)
84
85
 
85
86
    def extractfile(self, member):
86
 
        return open(member.fullpath)
 
87
        return open(member.fullpath, 'rb')
87
88
 
88
89
 
89
90
class FileInfo(object):
187
188
            target_tree=target_tree)
188
189
 
189
190
def import_dir(tree, dir, file_ids_from=None, target_tree=None):
190
 
    dir_input = BytesIO(dir.encode(sys.getfilesystemencoding()))
 
191
    dir_input = StringIO(dir)
191
192
    dir_file = DirWrapper(dir_input)
192
193
    import_archive(tree, dir_file, file_ids_from=file_ids_from,
193
194
            target_tree=target_tree)
389
390
        elif source.endswith('.zip'):
390
391
            import_zip(tree, open_from_url(source))
391
392
        elif file_kind(source) == 'directory':
392
 
            s = BytesIO(source)
 
393
            s = StringIO(source)
393
394
            s.seek(0)
394
395
            import_dir(tree, s)
395
396
        else: