~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/__init__.py

  • Committer: Ian Clatworthy
  • Date: 2008-07-23 13:29:55 UTC
  • mto: (4171.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 4173.
  • Revision ID: ian.clatworthy@canonical.com-20080723132955-kzxal29bslx51u36
add --filters to export command

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
 
56
56
    When requesting a specific type of export, load the respective path.
57
57
    """
58
 
    def _loader(tree, dest, root):
 
58
    def _loader(tree, dest, root, filtered):
59
59
        mod = __import__(module, globals(), locals(), [funcname])
60
60
        func = getattr(mod, funcname)
61
 
        return func(tree, dest, root)
 
61
        return func(tree, dest, root, filtered=filtered)
62
62
    register_exporter(scheme, extensions, _loader)
63
63
 
64
64
 
65
 
def export(tree, dest, format=None, root=None):
 
65
def export(tree, dest, format=None, root=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
76
76
                 If root is None, the default root will be
77
77
                 selected as the destination without its
78
78
                 extension.
 
79
    :param filtered: If True, content filtering is applied to the
 
80
                     files exported.
79
81
    """
80
82
    global _exporters, _exporter_extensions
81
83
 
94
96
        raise errors.NoSuchExportFormat(format)
95
97
    tree.lock_read()
96
98
    try:
97
 
        return _exporters[format](tree, dest, root)
 
99
        return _exporters[format](tree, dest, root, filtered=filtered)
98
100
    finally:
99
101
        tree.unlock()
100
102