Export tarball contents using bzrlib

Asked by xaav

Is it possible to export the contents of a tarball using bzrlib?

Example Psuedo code:

branch = new Branch("lp:launchpad")

tarballcontents = branch.exportTo("tar.gz");

# Save tarballcontents to file

I'm not looking to export to a file, I'm looking for the contents.

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
Martin Pool
Solved:
Last query:
Last reply:
Revision history for this message
Best Martin Pool (mbp) said :
#1

Have a look at bzrlib/export/tar_exporter.py. You should be able to
construct a tarball object pointing to for instance a StringIO, then
pass that to export_tarball.

hth
Martin

Revision history for this message
xaav (xaav) said :
#2

Thanks Martin Pool, that solved my question.

Revision history for this message
Martin Pool (mbp) said :
#3

If you're looking at doing this for the benefit of loggerhead
exporting tarballs (which would be so incredibly cool) then you
probably want to avoid building the whole thing in memory, and instead
pass an object which will stream it out as it's produced.

Martin