~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
            preview = tt.get_preview_tree()
136
136
            self.assertEqual(wt.get_root_id(), preview.get_root_id())
137
137
 
 
138
    def test_merge_unrelated_retains_root(self):
 
139
        wt = self.make_branch_and_tree('tree')
 
140
        root_id_before_merge = wt.get_root_id()
 
141
        other_tree = self.make_branch_and_tree('other')
 
142
        # Do a commit so there is something to merge
 
143
        other_tree.commit('commit other')
 
144
        self.assertNotEquals(root_id_before_merge, other_tree.get_root_id())
 
145
        wt.merge_from_branch(other_tree.branch,
 
146
                             from_revision=_mod_revision.NULL_REVISION)
 
147
        self.assertEqual(root_id_before_merge, wt.get_root_id())
 
148
 
 
149
    def test_merge_preview_unrelated_retains_root(self):
 
150
        wt = self.make_branch_and_tree('tree')
 
151
        other_tree = self.make_branch_and_tree('other')
 
152
        # Do a commit so there is something to merge
 
153
        other_tree.commit('commit other')
 
154
        merger = _mod_merge.Merge3Merger(wt, wt, wt.basis_tree(), other_tree,
 
155
                                         this_branch=wt.branch,
 
156
                                         do_merge=False)
 
157
        with merger.make_preview_transform() as tt:
 
158
            preview = tt.get_preview_tree()
 
159
            self.assertEqual(wt.get_root_id(), preview.get_root_id())
 
160
 
138
161
    def test_create_rename(self):
139
162
        """Rename an inventory entry while creating the file"""
140
163
        tree =self.make_branch_and_tree('.')
1879
1902
        builder.build_snapshot('C-id', ['A-id'], [])
1880
1903
        builder.build_snapshot('E-id', ['C-id', 'B-id'],
1881
1904
            [('unversion', 'a-id'),
 
1905
             ('flush', None),
1882
1906
             ('add', (u'a', 'a-id', 'directory', None))])
1883
1907
        builder.build_snapshot('D-id', ['B-id', 'C-id'], [])
1884
1908
        merge_obj = self.make_merge_obj(builder, 'E-id')
1902
1926
        builder.build_snapshot('E-id', ['C-id', 'B-id'], [])
1903
1927
        builder.build_snapshot('D-id', ['B-id', 'C-id'],
1904
1928
            [('unversion', 'a-id'),
 
1929
             ('flush', None),
1905
1930
             ('add', (u'a', 'a-id', 'directory', None))])
1906
1931
        merge_obj = self.make_merge_obj(builder, 'E-id')
1907
1932
        entries = list(merge_obj._entries_lca())