~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/__init__.py

  • Committer: Martin Pool
  • Date: 2011-07-21 07:08:05 UTC
  • mfrom: (6006.3.9 filter-tree)
  • mto: This revision was merged to the branch mainline in revision 6035.
  • Revision ID: mbp@canonical.com-20110721070805-1fne0y2fn8vnziwj
merge up ContentFilterTree to 2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import os
21
21
import time
 
22
import warnings
 
23
 
22
24
from bzrlib import (
23
25
    errors,
24
26
    pyutils,
58
60
 
59
61
    When requesting a specific type of export, load the respective path.
60
62
    """
61
 
    def _loader(tree, dest, root, subdir, filtered, force_mtime, fileobj):
 
63
    def _loader(tree, dest, root, subdir, force_mtime, fileobj):
62
64
        func = pyutils.get_named_object(module, funcname)
63
 
        return func(tree, dest, root, subdir, filtered=filtered,
64
 
                    force_mtime=force_mtime, fileobj=fileobj)
 
65
        return func(tree, dest, root, subdir, force_mtime=force_mtime,
 
66
            fileobj=fileobj)
65
67
 
66
68
    register_exporter(scheme, extensions, _loader)
67
69
 
91
93
        a directory to start exporting from.
92
94
 
93
95
    :param filtered: If True, content filtering is applied to the exported
94
 
        files.
 
96
        files.  Deprecated in favour of passing a ContentFilterTree
 
97
        as the source.
95
98
 
96
99
    :param per_file_timestamps: Whether to use the timestamp stored in the tree
97
100
        rather than now(). This will do a revision lookup for every file so
122
125
 
123
126
    trace.mutter('export version %r', tree)
124
127
 
 
128
    if filtered:
 
129
        from bzrlib.filter_tree import ContentFilterTree
 
130
        warnings.warn(
 
131
            "passing filtered=True to export is deprecated in bzr 2.4",
 
132
            stacklevel=2)
 
133
        tree = ContentFilterTree(tree, tree._content_filter_stack)
 
134
        # We don't want things re-filtered by the specific exporter.
 
135
        filtered = False
 
136
 
 
137
    tree.lock_read()
125
138
    try:
126
 
        tree.lock_read()
127
 
 
128
 
        for _ in _exporters[format](tree, dest, root, subdir,
129
 
                                    filtered=filtered,
130
 
                                    force_mtime=force_mtime, fileobj=fileobj):
131
 
 
 
139
        for _ in _exporters[format](
 
140
            tree, dest, root, subdir,
 
141
            force_mtime=force_mtime, fileobj=fileobj):
132
142
            yield
133
143
    finally:
134
144
        tree.unlock()
153
163
        the entire tree, and anything else should specify the relative path to
154
164
        a directory to start exporting from.
155
165
    :param filtered: If True, content filtering is applied to the
156
 
                     files exported.
 
166
        files exported.  Deprecated in favor of passing an ContentFilterTree.
157
167
    :param per_file_timestamps: Whether to use the timestamp stored in the
158
168
        tree rather than now(). This will do a revision lookup
159
169
        for every file so will be significantly slower.