1
"""Exports an archive from a bazaar branch"""
3
from bzrlib.export import get_export_generator
5
class ExporterFileObject(object):
11
self._buffer.append(str)
15
return ''.join(self._buffer)
19
def export_archive(history, revid, format=".tar.gz"):
20
"""Export tree contents to an archive
22
:param history: Instance of history to export
23
:param revid: Revision to export
24
:param format: Format of the archive
27
fileobj = ExporterFileObject()
29
tree = history._branch.repository.revision_tree(revid)
31
for _ in get_export_generator(tree=tree, fileobj=fileobj, format=format):
33
yield fileobj.get_buffer()
b'\\ No newline at end of file'