~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-08 02:23:17 UTC
  • mto: This revision was merged to the branch mainline in revision 5086.
  • Revision ID: jelmer@samba.org-20100308022317-hmxztr4jz5danig8
Review comments from Rob.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
Such as non-controlled directories, tarfiles, zipfiles, etc.
20
20
"""
21
21
 
22
 
from bzrlib.trace import mutter
23
22
import os
24
23
import bzrlib.errors as errors
25
24
 
55
54
 
56
55
    When requesting a specific type of export, load the respective path.
57
56
    """
58
 
    def _loader(tree, dest, root, subdir, filtered, use_tree_timestamp):
 
57
    def _loader(tree, dest, root, subdir, filtered, per_file_timestamps):
59
58
        mod = __import__(module, globals(), locals(), [funcname])
60
59
        func = getattr(mod, funcname)
61
60
        return func(tree, dest, root, subdir, filtered=filtered,
62
 
                    use_tree_timestamp=use_tree_timestamp)
 
61
                    per_file_timestamps=per_file_timestamps)
63
62
    register_exporter(scheme, extensions, _loader)
64
63
 
65
64
 
66
65
def export(tree, dest, format=None, root=None, subdir=None, filtered=False,
67
 
           use_tree_timestamp=False):
 
66
           per_file_timestamps=False):
68
67
    """Export the given Tree to the specific destination.
69
68
 
70
69
    :param tree: A Tree (such as RevisionTree) to export
83
82
        a directory to start exporting from.
84
83
    :param filtered: If True, content filtering is applied to the
85
84
                     files exported.
86
 
    :param use_tree_timestamp: Whether to use the timestamp stored in the 
87
 
        tree rather than now().
 
85
    :param per_file_timestamps: Whether to use the timestamp stored in the 
 
86
        tree rather than now(). This will do a revision lookup 
 
87
        for every file so will be significantly slower.
88
88
    """
89
89
    global _exporters, _exporter_extensions
90
90
 
104
104
    tree.lock_read()
105
105
    try:
106
106
        return _exporters[format](tree, dest, root, subdir, filtered=filtered,
107
 
                                  use_tree_timestamp=use_tree_timestamp)
 
107
                                  per_file_timestamps=per_file_timestamps)
108
108
    finally:
109
109
        tree.unlock()
110
110