~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2010-03-07 15:21:01 UTC
  • mto: This revision was merged to the branch mainline in revision 5086.
  • Revision ID: jelmer@samba.org-20100307152101-i0dsz1yovdeb3b3a
Add use_tree_timestamp argument to exporters.

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, subdir, filtered):
 
58
    def _loader(tree, dest, root, subdir, filtered, use_tree_timestamp):
59
59
        mod = __import__(module, globals(), locals(), [funcname])
60
60
        func = getattr(mod, funcname)
61
 
        return func(tree, dest, root, subdir, filtered=filtered)
 
61
        return func(tree, dest, root, subdir, filtered=filtered,
 
62
                    use_tree_timestamp=use_tree_timestamp)
62
63
    register_exporter(scheme, extensions, _loader)
63
64
 
64
65
 
65
 
def export(tree, dest, format=None, root=None, subdir=None, filtered=False):
 
66
def export(tree, dest, format=None, root=None, subdir=None, filtered=False,
 
67
           use_tree_timestamp=False):
66
68
    """Export the given Tree to the specific destination.
67
69
 
68
70
    :param tree: A Tree (such as RevisionTree) to export
81
83
        a directory to start exporting from.
82
84
    :param filtered: If True, content filtering is applied to the
83
85
                     files exported.
 
86
    :param use_tree_timestamp: Whether to use the timestamp stored in the 
 
87
        tree rather than now().
84
88
    """
85
89
    global _exporters, _exporter_extensions
86
90
 
99
103
        raise errors.NoSuchExportFormat(format)
100
104
    tree.lock_read()
101
105
    try:
102
 
        return _exporters[format](tree, dest, root, subdir, filtered=filtered)
 
106
        return _exporters[format](tree, dest, root, subdir, filtered=filtered,
 
107
                                  use_tree_timestamp=use_tree_timestamp)
103
108
    finally:
104
109
        tree.unlock()
105
110