~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/tar_exporter.py

Implemented fileobj in tbz_exporter.

Show diffs side-by-side

added added

removed removed

Lines of Context:
154
154
            stream.close()
155
155
 
156
156
 
157
 
def tbz_exporter(tree, dest, root, subdir, filtered=False, force_mtime=None):
 
157
def tbz_exporter(tree, dest, root, subdir, filtered=False, force_mtime=None,
 
158
                 per_file_timestamps=False, fileobj=None):
158
159
    """Export this tree to a new tar file.
159
160
 
160
161
    `dest` will be created holding the contents of this tree; if it
161
162
    already exists, it will be clobbered, like with "tar -c".
162
163
    """
163
 
    if dest == '-':
 
164
    if fileobj is not None:
 
165
        ball = tarfile.open(None, 'w|bz2', fileobj)
 
166
    elif dest == '-':
164
167
        ball = tarfile.open(None, 'w|bz2', sys.stdout)
165
168
    else:
166
169
        # tarfile.open goes on to do 'os.getcwd() + dest' for opening