~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-15 11:26:00 UTC
  • mfrom: (5757.7.7 knitpackrepo-6)
  • mto: This revision was merged to the branch mainline in revision 5801.
  • Revision ID: jelmer@samba.org-20110415112600-vrv2431lh3gi6wx2
MergeĀ knitpackrepo-6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1932
1932
        raise NotImplementedError(self.new_orphan)
1933
1933
 
1934
1934
 
1935
 
class _PreviewTree(tree.Tree):
 
1935
class _PreviewTree(tree.InventoryTree):
1936
1936
    """Partial implementation of Tree to support show_diff_trees"""
1937
1937
 
1938
1938
    def __init__(self, transform):
2541
2541
                    executable = tree.is_executable(file_id, tree_path)
2542
2542
                    if executable:
2543
2543
                        tt.set_executability(executable, trans_id)
2544
 
                    trans_data = (trans_id, tree_path)
 
2544
                    trans_data = (trans_id, tree_path, entry.text_sha1)
2545
2545
                    deferred_contents.append((file_id, trans_data))
2546
2546
                else:
2547
2547
                    file_trans_id[file_id] = new_by_entry(tt, entry, parent_id,
2592
2592
        unchanged = dict(unchanged)
2593
2593
        new_desired_files = []
2594
2594
        count = 0
2595
 
        for file_id, (trans_id, tree_path) in desired_files:
 
2595
        for file_id, (trans_id, tree_path, text_sha1) in desired_files:
2596
2596
            accelerator_path = unchanged.get(file_id)
2597
2597
            if accelerator_path is None:
2598
 
                new_desired_files.append((file_id, (trans_id, tree_path)))
 
2598
                new_desired_files.append((file_id,
 
2599
                    (trans_id, tree_path, text_sha1)))
2599
2600
                continue
2600
2601
            pb.update('Adding file contents', count + offset, total)
2601
2602
            if hardlink:
2608
2609
                    contents = filtered_output_bytes(contents, filters,
2609
2610
                        ContentFilterContext(tree_path, tree))
2610
2611
                try:
2611
 
                    tt.create_file(contents, trans_id)
 
2612
                    tt.create_file(contents, trans_id, sha1=text_sha1)
2612
2613
                finally:
2613
2614
                    try:
2614
2615
                        contents.close()
2617
2618
                        pass
2618
2619
            count += 1
2619
2620
        offset += count
2620
 
    for count, ((trans_id, tree_path), contents) in enumerate(
 
2621
    for count, ((trans_id, tree_path, text_sha1), contents) in enumerate(
2621
2622
            tree.iter_files_bytes(new_desired_files)):
2622
2623
        if wt.supports_content_filtering():
2623
2624
            filters = wt._content_filter_stack(tree_path)
2624
2625
            contents = filtered_output_bytes(contents, filters,
2625
2626
                ContentFilterContext(tree_path, tree))
2626
 
        tt.create_file(contents, trans_id)
 
2627
        tt.create_file(contents, trans_id, sha1=text_sha1)
2627
2628
        pb.update('Adding file contents', count + offset, total)
2628
2629
 
2629
2630
 
3038
3039
                        file_id = tt.final_file_id(trans_id)
3039
3040
                        if file_id is None:
3040
3041
                            file_id = tt.inactive_file_id(trans_id)
3041
 
                        entry = path_tree.inventory[file_id]
 
3042
                        _, entry = path_tree.iter_entries_by_dir(
 
3043
                            [file_id]).next()
3042
3044
                        # special-case the other tree root (move its
3043
3045
                        # children to current root)
3044
3046
                        if entry.parent_id is None: