~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Ian Clatworthy
  • Date: 2009-06-16 12:06:49 UTC
  • mto: (4634.102.1 eol-update-bug)
  • mto: This revision was merged to the branch mainline in revision 4857.
  • Revision ID: ian.clatworthy@canonical.com-20090616120649-weg1a7hmbmsdpvse
apply content filters when merging new files

Show diffs side-by-side

added added

removed removed

Lines of Context:
2325
2325
        tt.create_directory(trans_id)
2326
2326
 
2327
2327
 
2328
 
def create_from_tree(tt, trans_id, tree, file_id, bytes=None):
2329
 
    """Create new file contents according to tree contents."""
 
2328
def create_from_tree(tt, trans_id, tree, file_id, bytes=None,
 
2329
    filter_tree_path=None):
 
2330
    """Create new file contents according to tree contents.
 
2331
    
 
2332
    :param filter_tree_path: the tree path to use to lookup
 
2333
      content filters to apply to the bytes output in the working tree.
 
2334
      This only applies if the working tree supports content filtering.
 
2335
    """
2330
2336
    kind = tree.kind(file_id)
2331
2337
    if kind == 'directory':
2332
2338
        tt.create_directory(trans_id)
2337
2343
                bytes = tree_file.readlines()
2338
2344
            finally:
2339
2345
                tree_file.close()
 
2346
        wt = tt._tree
 
2347
        if wt.supports_content_filtering() and filter_tree_path is not None:
 
2348
            filters = wt._content_filter_stack(filter_tree_path)
 
2349
            bytes = filtered_output_bytes(bytes, filters,
 
2350
                ContentFilterContext(filter_tree_path, tree))
2340
2351
        tt.create_file(bytes, trans_id)
2341
2352
    elif kind == "symlink":
2342
2353
        tt.create_symlink(tree.get_symlink_target(file_id), trans_id)