~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

transform.final_kind() now returns None instead of raising NoSuchFile.

* bzrlib/transform.py:
(TreeTransformBase.final_kind): Just return None instead of
raising NoSuchFile since all callers just do that while catching
the exception.
(TreeTransformBase._improper_versioning)
(TreeTransformBase._executability_conflicts)
(TreeTransformBase._duplicate_entries)
(TreeTransformBase._parent_type_conflicts)
(TreeTransformBase._any_contents, TreeTransformBase._to_file_data)
(TreeTransform._generate_inventory_delta)
(_PreviewTree._make_inv_entries, _PreviewTree.walkdirs): Fix call
sites.

* bzrlib/tests/test_transform.py:
(TestTreeTransform.test_build): The single test needing a fix for
final_kind returning None...

* bzrlib/merge.py:
(Merge3Merger.fix_root, Merge3Merger.fix_root)
(Merge3Merger._merge_executable): Simplify final_kind() uses.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1029
1029
 
1030
1030
 
1031
1031
    def fix_root(self):
1032
 
        try:
1033
 
            self.tt.final_kind(self.tt.root)
1034
 
        except errors.NoSuchFile:
 
1032
        if self.tt.final_kind(self.tt.root) is None:
1035
1033
            self.tt.cancel_deletion(self.tt.root)
1036
1034
        if self.tt.final_file_id(self.tt.root) is None:
1037
1035
            self.tt.version_file(self.tt.tree_file_id(self.tt.root),
1042
1040
        other_root = self.tt.trans_id_file_id(other_root_file_id)
1043
1041
        if other_root == self.tt.root:
1044
1042
            return
1045
 
        try:
1046
 
            self.tt.final_kind(other_root)
1047
 
        except errors.NoSuchFile:
 
1043
        if self.tt.final_kind(other_root) is None:
1048
1044
            return
1049
1045
        if self.this_tree.has_id(self.other_tree.inventory.root.file_id):
1050
1046
            # the other tree's root is a non-root in the current tree
1513
1509
        if winner == 'this' and file_status != "modified":
1514
1510
            return
1515
1511
        trans_id = self.tt.trans_id_file_id(file_id)
1516
 
        try:
1517
 
            if self.tt.final_kind(trans_id) != "file":
1518
 
                return
1519
 
        except errors.NoSuchFile:
 
1512
        if self.tt.final_kind(trans_id) != "file":
1520
1513
            return
1521
1514
        if winner == "this":
1522
1515
            executability = this_executable