Package b.export

Part of bzrlib

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

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

Kind Name Docs
Module dir_exporter Export a Tree to a non-versioned 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:

Line # Kind Name Docs
65 Function export Export the given Tree to the specific destination.
105 Function get_root_name Get just the root name for an export.
31 Function register_exporter Register an exporter.
53 Function register_lazy_exporter Register lazy-loaded exporter function.
135 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):
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.
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 a directory to start exporting from.
API Documentation for BzrLib, generated by pydoctor at 2008-12-03 00:00:12.