~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/tar_exporter.py

resolve conflicts against trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
        root_mtime = tree.get_file_mtime(tree.get_root_id())
105
105
    else:
106
106
        root_mtime = None
 
107
 
 
108
    is_stdout = False
107
109
    if dest == '-':
108
110
        basename = None
109
111
        stream = sys.stdout
 
112
        is_stdout = True
110
113
    else:
111
114
        stream = open(dest, 'wb')
112
115
        # gzip file is used with an explicit fileobj so that
114
117
        # dest. (bug 102234)
115
118
        basename = os.path.basename(dest)
116
119
    try:
117
 
        stream = gzip.GzipFile(basename, 'w', fileobj=stream, mtime=root_mtime)
 
120
        zipstream = gzip.GzipFile(basename, 'w', fileobj=stream, mtime=root_mtime)
118
121
    except TypeError:
119
122
        # Python < 2.7 doesn't support the mtime argument
120
 
        stream = gzip.GzipFile(basename, 'w', fileobj=stream)
121
 
    ball = tarfile.open(None, 'w|', fileobj=stream)
 
123
        zipstream = gzip.GzipFile(basename, 'w', fileobj=stream)
 
124
    ball = tarfile.open(None, 'w|', fileobj=zipstream)
122
125
    export_tarball(tree, ball, root, subdir, filtered=filtered,
123
126
                   force_mtime=force_mtime)
124
127
    ball.close()
 
128
    zipstream.close()
 
129
    if not is_stdout:
 
130
        stream.close()
125
131
 
126
132
 
127
133
def tbz_exporter(tree, dest, root, subdir, filtered=False, force_mtime=None):