~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-12-03 05:08:05 UTC
  • mfrom: (4854.1.1 merge-2.0-into-devel)
  • Revision ID: pqm@pqm.ubuntu.com-20091203050805-s70sybyrsrbbs10c
(andrew) Merge lp:bzr/2.0 into lp:bzr.

Show diffs side-by-side

added added

removed removed

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