b.export : package documentation

Part of bzrlib

Export functionality, which can take a Tree and create a different representation.

Such as non-controlled directories, tarfiles, zipfiles, etc.

Module dir_exporter Export a bzrlib.tree.Tree to a new or empty directory.
Module tar_exporter Export a Tree to a non-versioned directory.
Module zip_exporter Export a Tree to a non-versioned directory.

From the __init__.py module:

Function export Export the given Tree to the specific destination.
Function get_root_name Get just the root name for an export.
Function register_exporter Register an exporter.
Function register_lazy_exporter Register lazy-loaded exporter function.
Function _export_iter_entries Iter the entries for tree suitable for exporting.
def register_exporter(format, extensions, func, override=False):
Register an exporter.
ParametersformatThis is the name of the format, such as 'tgz' or 'zip'
extensionsExtensions which should be used in the case that a format was not explicitly specified. (type: List)
funcThe function. It will be called with (tree, dest, root)
overrideWhether to override an object which already exists. Frequently plugins will want to provide functionality until it shows up in mainline, so the default is False.
def register_lazy_exporter(scheme, extensions, module, funcname):
Register lazy-loaded exporter function.

When requesting a specific type of export, load the respective path.

def export(tree, dest, format=None, root=None, subdir=None, filtered=False, per_file_timestamps=False):
Export the given Tree to the specific destination.
ParameterstreeA Tree (such as RevisionTree) to export
destThe destination where the files,etc should be put
formatThe format (dir, zip, etc), if None, it will check the extension on dest, looking for a match
rootThe root location inside the format. It is common practise to have zipfiles and tarballs extract into a subdirectory, rather than into the current working directory. If root is None, the default root will be selected as the destination without its extension.
subdirA starting directory within the tree. None means to export the entire tree, and anything else should specify the relative path to a directory to start exporting from.
filteredIf True, content filtering is applied to the files exported.
per_file_timestampsWhether to use the timestamp stored in the tree rather than now(). This will do a revision lookup for every file so will be significantly slower.
def get_root_name(dest):

Get just the root name for an export.

>>> get_root_name('../mytest.tar')
'mytest'
>>> get_root_name('mytar.tar')
'mytar'
>>> get_root_name('mytar.tar.bz2')
'mytar'
>>> get_root_name('tar.tar.tar.tgz')
'tar.tar.tar'
>>> get_root_name('bzr-0.0.5.tar.gz')
'bzr-0.0.5'
>>> get_root_name('bzr-0.0.5.zip')
'bzr-0.0.5'
>>> get_root_name('bzr-0.0.5')
'bzr-0.0.5'
>>> get_root_name('a/long/path/mytar.tgz')
'mytar'
>>> get_root_name('../parent/../dir/other.tbz2')
'other'
def _export_iter_entries(tree, subdir):
Iter the entries for tree suitable for exporting.
ParameterstreeA tree object.
subdirNone or the path of an entry to start exporting from.
API Documentation for Bazaar, generated by pydoctor at 2010-03-15 00:09:49.