~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    map[key] = value
37
37
 
38
38
 
 
39
class _TransformResults(object):
 
40
    def __init__(self, modified_paths):
 
41
        object.__init__(self)
 
42
        self.modified_paths = modified_paths
 
43
 
 
44
 
39
45
class TreeTransform(object):
40
46
    """Represent a tree transformation.
41
47
    
660
666
        limbo_inv = {}
661
667
        inv = self._tree.inventory
662
668
        self._apply_removals(inv, limbo_inv)
663
 
        self._apply_insertions(inv, limbo_inv)
 
669
        modified_paths = self._apply_insertions(inv, limbo_inv)
664
670
        self._tree._write_inventory(inv)
665
671
        self.__done = True
666
672
        self.finalize()
 
673
        return _TransformResults(modified_paths)
667
674
 
668
675
    def _limbo_name(self, trans_id):
669
676
        """Generate the limbo name of a file"""
711
718
        parent-to-child order.
712
719
        """
713
720
        new_paths = self.new_paths()
 
721
        modified_paths = []
714
722
        for num, (path, trans_id) in enumerate(new_paths):
715
723
            self._pb.update('adding file', num+1, len(new_paths))
716
724
            try:
726
734
                    if e.errno != errno.ENOENT:
727
735
                        raise
728
736
                if trans_id in self._new_contents:
 
737
                    modified_paths.append(full_path)
729
738
                    del self._new_contents[trans_id]
730
739
 
731
740
            if trans_id in self._new_id:
744
753
            if trans_id in self._new_executability:
745
754
                self._set_executability(path, inv, trans_id)
746
755
        self._pb.clear()
 
756
        return modified_paths
747
757
 
748
758
    def _set_executability(self, path, inv, trans_id):
749
759
        """Set the executability of versioned files """
1001
1011
        return interesting_ids is None or file_id in interesting_ids
1002
1012
 
1003
1013
    tt = TreeTransform(working_tree, pb)
 
1014
    merge_modified = working_tree.merge_modified()
1004
1015
    try:
1005
1016
        trans_id = {}
1006
1017
        def trans_id_file_id(file_id):
1019
1030
                e_trans_id = new_by_entry(tt, entry, parent_id, target_tree)
1020
1031
                trans_id[file_id] = e_trans_id
1021
1032
            else:
 
1033
                backup_this = backups
 
1034
                if file_id in merge_modified:
 
1035
                    backup_this = False
 
1036
                    del merge_modified[file_id]
1022
1037
                change_entry(tt, file_id, working_tree, target_tree, 
1023
 
                             trans_id_file_id, backups, trans_id)
 
1038
                             trans_id_file_id, backup_this, trans_id)
1024
1039
        wt_interesting = [i for i in working_tree.inventory if interesting(i)]
1025
1040
        for id_num, file_id in enumerate(wt_interesting):
1026
1041
            pb.update("New file check", id_num+1, len(sorted_interesting))
1027
1042
            if file_id not in target_tree:
1028
 
                tt.unversion_file(tt.trans_id_tree_file_id(file_id))
 
1043
                trans_id = tt.trans_id_tree_file_id(file_id)
 
1044
                tt.unversion_file(trans_id)
 
1045
                if file_id in merge_modified:
 
1046
                    tt.delete_contents(trans_id)
 
1047
                    del merge_modified[file_id]
1029
1048
        raw_conflicts = resolve_conflicts(tt, pb)
1030
1049
        for line in conflicts_strings(cook_conflicts(raw_conflicts, tt)):
1031
1050
            warning(line)
1032
1051
        tt.apply()
 
1052
        working_tree.set_merge_modified({})
1033
1053
    finally:
1034
1054
        tt.finalize()
1035
1055
        pb.clear()