~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-06 06:48:25 UTC
  • mfrom: (4070.8.6 debug-config)
  • Revision ID: pqm@pqm.ubuntu.com-20090306064825-kbpwggw21dygeix6
(mbp) debug_flags configuration option

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
import os
18
18
import errno
36
36
                           ReusingTransform, NotVersionedError, CantMoveRoot,
37
37
                           ExistingLimbo, ImmortalLimbo, NoFinalPath,
38
38
                           UnableCreateSymlink)
39
 
from bzrlib.filters import filtered_output_bytes, ContentFilterContext
40
39
from bzrlib.inventory import InventoryEntry
41
40
from bzrlib.osutils import (
42
41
    delete_any,
1846
1845
                size = None
1847
1846
                executable = None
1848
1847
            if kind == 'symlink':
1849
 
                link_or_sha1 = os.readlink(limbo_name).decode(osutils._fs_enc)
 
1848
                link_or_sha1 = os.readlink(limbo_name)
1850
1849
        if supports_executable():
1851
1850
            executable = tt._new_executability.get(trans_id, executable)
1852
1851
        return kind, size, executable, link_or_sha1
2114
2113
                    executable = tree.is_executable(file_id, tree_path)
2115
2114
                    if executable:
2116
2115
                        tt.set_executability(executable, trans_id)
2117
 
                    trans_data = (trans_id, tree_path)
2118
 
                    deferred_contents.append((file_id, trans_data))
 
2116
                    deferred_contents.append((file_id, trans_id))
2119
2117
                else:
2120
2118
                    file_trans_id[file_id] = new_by_entry(tt, entry, parent_id,
2121
2119
                                                          tree)
2152
2150
def _create_files(tt, tree, desired_files, pb, offset, accelerator_tree,
2153
2151
                  hardlink):
2154
2152
    total = len(desired_files) + offset
2155
 
    wt = tt._tree
2156
2153
    if accelerator_tree is None:
2157
2154
        new_desired_files = desired_files
2158
2155
    else:
2161
2158
                         in iter if not (c or e[0] != e[1]))
2162
2159
        new_desired_files = []
2163
2160
        count = 0
2164
 
        for file_id, (trans_id, tree_path) in desired_files:
 
2161
        for file_id, trans_id in desired_files:
2165
2162
            accelerator_path = unchanged.get(file_id)
2166
2163
            if accelerator_path is None:
2167
 
                new_desired_files.append((file_id, (trans_id, tree_path)))
 
2164
                new_desired_files.append((file_id, trans_id))
2168
2165
                continue
2169
2166
            pb.update('Adding file contents', count + offset, total)
2170
2167
            if hardlink:
2172
2169
                                   trans_id)
2173
2170
            else:
2174
2171
                contents = accelerator_tree.get_file(file_id, accelerator_path)
2175
 
                if wt.supports_content_filtering():
2176
 
                    filters = wt._content_filter_stack(tree_path)
2177
 
                    contents = filtered_output_bytes(contents, filters,
2178
 
                        ContentFilterContext(tree_path, tree))
2179
2172
                try:
2180
2173
                    tt.create_file(contents, trans_id)
2181
2174
                finally:
2182
 
                    try:
2183
 
                        contents.close()
2184
 
                    except AttributeError:
2185
 
                        # after filtering, contents may no longer be file-like
2186
 
                        pass
 
2175
                    contents.close()
2187
2176
            count += 1
2188
2177
        offset += count
2189
 
    for count, ((trans_id, tree_path), contents) in enumerate(
2190
 
            tree.iter_files_bytes(new_desired_files)):
2191
 
        if wt.supports_content_filtering():
2192
 
            filters = wt._content_filter_stack(tree_path)
2193
 
            contents = filtered_output_bytes(contents, filters,
2194
 
                ContentFilterContext(tree_path, tree))
 
2178
    for count, (trans_id, contents) in enumerate(tree.iter_files_bytes(
 
2179
                                                 new_desired_files)):
2195
2180
        tt.create_file(contents, trans_id)
2196
2181
        pb.update('Adding file contents', count + offset, total)
2197
2182