/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

Merge 2.0 into 2.1 including fixes for #262450, #373898, #498409

Show diffs side-by-side

added added

removed removed

Lines of Context:
1051
1051
        other_root = self.tt.trans_id_file_id(other_root_file_id)
1052
1052
        if other_root == self.tt.root:
1053
1053
            return
 
1054
        if self.other_tree.inventory.root.file_id in self.this_tree.inventory:
 
1055
            # the other tree's root is a non-root in the current tree (as when
 
1056
            # a previously unrelated branch is merged into another)
 
1057
            return
1054
1058
        try:
1055
1059
            self.tt.final_kind(other_root)
1056
 
        except errors.NoSuchFile:
1057
 
            return
1058
 
        if self.this_tree.has_id(self.other_tree.inventory.root.file_id):
1059
 
            # the other tree's root is a non-root in the current tree
1060
 
            return
1061
 
        self.reparent_children(self.other_tree.inventory.root, self.tt.root)
1062
 
        self.tt.cancel_creation(other_root)
1063
 
        self.tt.cancel_versioning(other_root)
1064
 
 
1065
 
    def reparent_children(self, ie, target):
1066
 
        for thing, child in ie.children.iteritems():
 
1060
            other_root_is_present = True
 
1061
        except NoSuchFile:
 
1062
            # other_root doesn't have a physical representation. We still need
 
1063
            # to move any references to the actual root of the tree.
 
1064
            other_root_is_present = False
 
1065
        # 'other_tree.inventory.root' is not present in this tree. We are
 
1066
        # calling adjust_path for children which *want* to be present with a
 
1067
        # correct place to go.
 
1068
        for thing, child in self.other_tree.inventory.root.children.iteritems():
1067
1069
            trans_id = self.tt.trans_id_file_id(child.file_id)
1068
 
            self.tt.adjust_path(self.tt.final_name(trans_id), target, trans_id)
 
1070
            if not other_root_is_present:
 
1071
                # FIXME: Make final_kind returns None instead of raising
 
1072
                # NoSuchFile to avoid the ugly construct below -- vila 20100402
 
1073
                try:
 
1074
                    self.tt.final_kind(trans_id)
 
1075
                    # The item exist in the final tree and has a defined place
 
1076
                    # to go already.
 
1077
                    continue
 
1078
                except errors.NoSuchFile, e:
 
1079
                    pass
 
1080
            # Move the item into the root
 
1081
            self.tt.adjust_path(self.tt.final_name(trans_id),
 
1082
                                self.tt.root, trans_id)
 
1083
        if other_root_is_present:
 
1084
            self.tt.cancel_creation(other_root)
 
1085
            self.tt.cancel_versioning(other_root)
1069
1086
 
1070
1087
    def write_modified(self, results):
1071
1088
        modified_hashes = {}