~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
2420
2420
        tt.create_directory(trans_id)
2421
2421
 
2422
2422
 
2423
 
def create_from_tree(tt, trans_id, tree, file_id, bytes=None):
2424
 
    """Create new file contents according to tree contents."""
 
2423
def create_from_tree(tt, trans_id, tree, file_id, bytes=None,
 
2424
    filter_tree_path=None):
 
2425
    """Create new file contents according to tree contents.
 
2426
    
 
2427
    :param filter_tree_path: the tree path to use to lookup
 
2428
      content filters to apply to the bytes output in the working tree.
 
2429
      This only applies if the working tree supports content filtering.
 
2430
    """
2425
2431
    kind = tree.kind(file_id)
2426
2432
    if kind == 'directory':
2427
2433
        tt.create_directory(trans_id)
2432
2438
                bytes = tree_file.readlines()
2433
2439
            finally:
2434
2440
                tree_file.close()
 
2441
        wt = tt._tree
 
2442
        if wt.supports_content_filtering() and filter_tree_path is not None:
 
2443
            filters = wt._content_filter_stack(filter_tree_path)
 
2444
            bytes = filtered_output_bytes(bytes, filters,
 
2445
                ContentFilterContext(filter_tree_path, tree))
2435
2446
        tt.create_file(bytes, trans_id)
2436
2447
    elif kind == "symlink":
2437
2448
        tt.create_symlink(tree.get_symlink_target(file_id), trans_id)