/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/upstream_import.py

  • Committer: Jelmer Vernooij
  • Date: 2019-05-29 03:22:34 UTC
  • mfrom: (7303 work)
  • mto: This revision was merged to the branch mainline in revision 7306.
  • Revision ID: jelmer@jelmer.uk-20190529032234-mt3fuws8gq03tapi
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import errno
22
22
from io import (
23
23
    BytesIO,
24
 
    StringIO,
25
24
    )
26
25
import os
27
26
import re
29
28
import tarfile
30
29
import zipfile
31
30
 
32
 
from . import generate_ids, urlutils
 
31
from . import urlutils
 
32
from .bzr import generate_ids
33
33
from .controldir import ControlDir, is_control_filename
34
34
from .errors import (BzrError, NoSuchFile, BzrCommandError, NotBranchError)
35
35
from .osutils import (pathjoin, isdir, file_iterator, basename,
75
75
 
76
76
    def add(self, filename):
77
77
        if isdir(filename):
78
 
            self.zipfile.writestr(filename+'/', '')
 
78
            self.zipfile.writestr(filename + '/', '')
79
79
        else:
80
80
            self.zipfile.write(filename)
81
81
 
220
220
    tar_file = tarfile.open('lala', 'r', tar_input)
221
221
    import_archive(tree, tar_file)
222
222
 
 
223
 
223
224
def import_zip(tree, zip_input):
224
225
    zip_file = ZipFileWrapper(zip_input, 'r')
225
226
    import_archive(tree, zip_file)
263
264
        if not isinstance(relative_path, text_type):
264
265
            relative_path = relative_path.decode('utf-8')
265
266
        if prefix is not None:
266
 
            relative_path = relative_path[len(prefix)+1:]
 
267
            relative_path = relative_path[len(prefix) + 1:]
267
268
            relative_path = relative_path.rstrip('/')
268
269
        if relative_path == '':
269
270
            continue