~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-07-07 10:56:19 UTC
  • mfrom: (6011.2.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20110707105619-6tftefqyt2zlmho5
(vila) Merging unrelated trees prefers THIS root (Aaron Bentley)

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('.')