~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/__init__.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Export trees to tarballs, non-controlled directories, zipfiles, etc.
18
18
"""
19
19
 
 
20
from __future__ import absolute_import
 
21
 
20
22
import os
21
23
import time
 
24
import warnings
 
25
 
22
26
from bzrlib import (
23
27
    errors,
24
28
    pyutils,
58
62
 
59
63
    When requesting a specific type of export, load the respective path.
60
64
    """
61
 
    def _loader(tree, dest, root, subdir, filtered, force_mtime, fileobj):
 
65
    def _loader(tree, dest, root, subdir, force_mtime, fileobj):
62
66
        func = pyutils.get_named_object(module, funcname)
63
 
        return func(tree, dest, root, subdir, filtered=filtered,
64
 
                    force_mtime=force_mtime, fileobj=fileobj)
 
67
        return func(tree, dest, root, subdir, force_mtime=force_mtime,
 
68
            fileobj=fileobj)
65
69
 
66
70
    register_exporter(scheme, extensions, _loader)
67
71
 
91
95
        a directory to start exporting from.
92
96
 
93
97
    :param filtered: If True, content filtering is applied to the exported
94
 
        files.
 
98
        files.  Deprecated in favour of passing a ContentFilterTree
 
99
        as the source.
95
100
 
96
101
    :param per_file_timestamps: Whether to use the timestamp stored in the tree
97
102
        rather than now(). This will do a revision lookup for every file so
122
127
 
123
128
    trace.mutter('export version %r', tree)
124
129
 
 
130
    if filtered:
 
131
        from bzrlib.filter_tree import ContentFilterTree
 
132
        warnings.warn(
 
133
            "passing filtered=True to export is deprecated in bzr 2.4",
 
134
            stacklevel=2)
 
135
        tree = ContentFilterTree(tree, tree._content_filter_stack)
 
136
        # We don't want things re-filtered by the specific exporter.
 
137
        filtered = False
 
138
 
 
139
    tree.lock_read()
125
140
    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
 
 
 
141
        for _ in _exporters[format](
 
142
            tree, dest, root, subdir,
 
143
            force_mtime=force_mtime, fileobj=fileobj):
132
144
            yield
133
145
    finally:
134
146
        tree.unlock()
153
165
        the entire tree, and anything else should specify the relative path to
154
166
        a directory to start exporting from.
155
167
    :param filtered: If True, content filtering is applied to the
156
 
                     files exported.
 
168
        files exported.  Deprecated in favor of passing an ContentFilterTree.
157
169
    :param per_file_timestamps: Whether to use the timestamp stored in the
158
170
        tree rather than now(). This will do a revision lookup
159
171
        for every file so will be significantly slower.
185
197
    :param tree: A tree object.
186
198
    :param subdir: None or the path of an entry to start exporting from.
187
199
    :param skip_special: Whether to skip .bzr files.
 
200
    :return: iterator over tuples with final path, tree path and inventory
 
201
        entry for each entry to export
188
202
    """
189
203
    if subdir == '':
190
204
        subdir = None
211
225
        if not tree.has_filename(path):
212
226
            continue
213
227
 
214
 
        yield final_path, entry
 
228
        yield final_path, path, entry
215
229
 
216
230
 
217
231
register_lazy_exporter(None, [], 'bzrlib.export.dir_exporter',