~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: John Arbash Meinel
  • Date: 2010-08-30 21:23:49 UTC
  • mto: This revision was merged to the branch mainline in revision 5398.
  • Revision ID: john@arbash-meinel.com-20100830212349-figt9yz2cic6hy68
Remove the 'false' invocation.

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