~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to upstream_import.py

  • Committer: Aaron Bentley
  • Date: 2007-06-18 23:52:33 UTC
  • Revision ID: abentley@panoramicfeedback.com-20070618235233-7ick9errjikvy4di
Fix no-collapse behavior

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
from bzrlib.trace import warning
17
17
from bzrlib.transform import TreeTransform, resolve_conflicts, cook_conflicts
18
18
from bzrlib.workingtree import WorkingTree
19
 
from bzrlib.plugins.bzrtools.bzrtools import open_from_url
20
19
 
21
20
class ZipFileWrapper(object):
22
21
 
268
267
        if (source.endswith('.tar') or source.endswith('.tar.gz') or
269
268
            source.endswith('.tar.bz2')) or source.endswith('.tgz'):
270
269
            try:
271
 
                tar_input = open_from_url(source)
272
270
                if source.endswith('.bz2'):
273
 
                    tar_input = StringIO(tar_input.read().decode('bz2'))
 
271
                    tar_input = BZ2File(source, 'r')
 
272
                    tar_input = StringIO(tar_input.read())
 
273
                else:
 
274
                    tar_input = file(source, 'rb')
274
275
            except IOError, e:
275
276
                if e.errno == errno.ENOENT:
276
277
                    raise NoSuchFile(source)
279
280
            finally:
280
281
                tar_input.close()
281
282
        elif source.endswith('.zip'):
282
 
            import_zip(tree, open_from_url(source))
 
283
            import_zip(tree, open(source, 'rb'))
283
284
        elif file_kind(source) == 'directory':
284
285
            s = StringIO(source)
285
286
            s.seek(0)