~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/__init__.py

  • Committer: Andrew Bennetts
  • Date: 2009-07-27 05:35:00 UTC
  • mfrom: (4570 +trunk)
  • mto: (4634.6.29 2.0)
  • mto: This revision was merged to the branch mainline in revision 4680.
  • Revision ID: andrew.bennetts@canonical.com-20090727053500-q76zsn2dx33jhmj5
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Export functionality, which can take a Tree and create a different representation.
18
18
 
55
55
 
56
56
    When requesting a specific type of export, load the respective path.
57
57
    """
58
 
    def _loader(tree, dest, root, subdir):
 
58
    def _loader(tree, dest, root, subdir, filtered):
59
59
        mod = __import__(module, globals(), locals(), [funcname])
60
60
        func = getattr(mod, funcname)
61
 
        return func(tree, dest, root, subdir)
 
61
        return func(tree, dest, root, subdir, filtered=filtered)
62
62
    register_exporter(scheme, extensions, _loader)
63
63
 
64
64
 
65
 
def export(tree, dest, format=None, root=None, subdir=None):
 
65
def export(tree, dest, format=None, root=None, subdir=None, filtered=False):
66
66
    """Export the given Tree to the specific destination.
67
67
 
68
68
    :param tree: A Tree (such as RevisionTree) to export
79
79
    :param subdir: A starting directory within the tree. None means to export
80
80
        the entire tree, and anything else should specify the relative path to
81
81
        a directory to start exporting from.
 
82
    :param filtered: If True, content filtering is applied to the
 
83
                     files exported.
82
84
    """
83
85
    global _exporters, _exporter_extensions
84
86
 
97
99
        raise errors.NoSuchExportFormat(format)
98
100
    tree.lock_read()
99
101
    try:
100
 
        return _exporters[format](tree, dest, root, subdir)
 
102
        return _exporters[format](tree, dest, root, subdir, filtered=filtered)
101
103
    finally:
102
104
        tree.unlock()
103
105