~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Andrea Corbellini
  • Date: 2010-09-04 15:34:10 UTC
  • mfrom: (5409 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5416.
  • Revision ID: corbellini.andrea@gmail.com-20100904153410-yybczvr4j1tmztdy
Merge with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1085
1085
        return result
1086
1086
 
1087
1087
    def fix_root(self):
1088
 
        try:
1089
 
            self.tt.final_kind(self.tt.root)
1090
 
        except errors.NoSuchFile:
 
1088
        if self.tt.final_kind(self.tt.root) is None:
1091
1089
            self.tt.cancel_deletion(self.tt.root)
1092
1090
        if self.tt.final_file_id(self.tt.root) is None:
1093
1091
            self.tt.version_file(self.tt.tree_file_id(self.tt.root),
1102
1100
            # the other tree's root is a non-root in the current tree (as when
1103
1101
            # a previously unrelated branch is merged into another)
1104
1102
            return
1105
 
        try:
1106
 
            self.tt.final_kind(other_root)
 
1103
        if self.tt.final_kind(other_root) is not None:
1107
1104
            other_root_is_present = True
1108
 
        except errors.NoSuchFile:
 
1105
        else:
1109
1106
            # other_root doesn't have a physical representation. We still need
1110
1107
            # to move any references to the actual root of the tree.
1111
1108
            other_root_is_present = False
1115
1112
        for thing, child in self.other_tree.inventory.root.children.iteritems():
1116
1113
            trans_id = self.tt.trans_id_file_id(child.file_id)
1117
1114
            if not other_root_is_present:
1118
 
                # FIXME: Make final_kind returns None instead of raising
1119
 
                # NoSuchFile to avoid the ugly construct below -- vila 20100402
1120
 
                try:
1121
 
                    self.tt.final_kind(trans_id)
 
1115
                if self.tt.final_kind(trans_id) is not None:
1122
1116
                    # The item exist in the final tree and has a defined place
1123
1117
                    # to go already.
1124
1118
                    continue
1125
 
                except errors.NoSuchFile, e:
1126
 
                    pass
1127
1119
            # Move the item into the root
1128
1120
            self.tt.adjust_path(self.tt.final_name(trans_id),
1129
1121
                                self.tt.root, trans_id)
1405
1397
            self.tt.version_file(file_id, trans_id)
1406
1398
        # The merge has been performed, so the old contents should not be
1407
1399
        # retained.
1408
 
        try:
1409
 
            self.tt.delete_contents(trans_id)
1410
 
        except errors.NoSuchFile:
1411
 
            pass
 
1400
        self.tt.delete_contents(trans_id)
1412
1401
        return result
1413
1402
 
1414
1403
    def _default_other_winner_merge(self, merge_hook_params):
1586
1575
        if winner == 'this' and file_status != "modified":
1587
1576
            return
1588
1577
        trans_id = self.tt.trans_id_file_id(file_id)
1589
 
        try:
1590
 
            if self.tt.final_kind(trans_id) != "file":
1591
 
                return
1592
 
        except errors.NoSuchFile:
 
1578
        if self.tt.final_kind(trans_id) != "file":
1593
1579
            return
1594
1580
        if winner == "this":
1595
1581
            executability = this_executable