Part of bzrlib
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. |
| Parameters | format | This is the name of the format, such as 'tgz' or 'zip' |
| extensions | Extensions which should be used in the case that a format was not explicitly specified. (type: List) | |
| func | The function. It will be called with (tree, dest, root) | |
| override | Whether 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. |
When requesting a specific type of export, load the respective path.
| Parameters | tree | A Tree (such as RevisionTree) to export |
| dest | The destination where the files,etc should be put | |
| format | The format (dir, zip, etc), if None, it will check the extension on dest, looking for a match | |
| root | The 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. | |
| subdir | A 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. | |
| filtered | If True, content filtering is applied to the files exported. | |
| per_file_timestamps | Whether 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. |
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'