~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

  • Committer: Alexander Belchenko
  • Date: 2009-08-27 07:30:31 UTC
  • mto: (4595.14.1 1.18)
  • mto: This revision was merged to the branch mainline in revision 4660.
  • Revision ID: bialix@ukr.net-20090827073031-dgm9i4kx8610p8tq
[cherrypick revno 4650 from bzr.dev] Fix shelve on windows. (Robert Collins, #305006)

Show diffs side-by-side

added added

removed removed

Lines of Context:
218
218
        tree_a.add('file')
219
219
        tree_a.commit('commit base')
220
220
        # basis_tree() is only guaranteed to be valid as long as it is actually
221
 
        # the basis tree. This mutates the tree after grabbing basis, so go to
222
 
        # the repository.
 
221
        # the basis tree. This test commits to the tree after grabbing basis,
 
222
        # so we go to the repository.
223
223
        base_tree = tree_a.branch.repository.revision_tree(tree_a.last_revision())
224
224
        tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree()
225
225
        self.build_tree_contents([('tree_a/file', 'content_2')])
226
226
        tree_a.commit('commit other')
227
227
        other_tree = tree_a.basis_tree()
 
228
        # 'file' is now missing but isn't altered in any commit in b so no
 
229
        # change should be applied.
228
230
        os.unlink('tree_b/file')
229
231
        merge_inner(tree_b.branch, other_tree, base_tree, this_tree=tree_b)
230
232
 
1232
1234
 
1233
1235
class TestMergerInMemory(TestMergerBase):
1234
1236
 
 
1237
    def test_cache_trees_with_revision_ids_None(self):
 
1238
        merger = self.make_Merger(self.setup_simple_graph(), 'C-id')
 
1239
        original_cache = dict(merger._cached_trees)
 
1240
        merger.cache_trees_with_revision_ids([None])
 
1241
        self.assertEqual(original_cache, merger._cached_trees)
 
1242
 
 
1243
    def test_cache_trees_with_revision_ids_no_revision_id(self):
 
1244
        merger = self.make_Merger(self.setup_simple_graph(), 'C-id')
 
1245
        original_cache = dict(merger._cached_trees)
 
1246
        tree = self.make_branch_and_memory_tree('tree')
 
1247
        merger.cache_trees_with_revision_ids([tree])
 
1248
        self.assertEqual(original_cache, merger._cached_trees)
 
1249
 
 
1250
    def test_cache_trees_with_revision_ids_having_revision_id(self):
 
1251
        merger = self.make_Merger(self.setup_simple_graph(), 'C-id')
 
1252
        original_cache = dict(merger._cached_trees)
 
1253
        tree = merger.this_branch.repository.revision_tree('B-id')
 
1254
        original_cache['B-id'] = tree
 
1255
        merger.cache_trees_with_revision_ids([tree])
 
1256
        self.assertEqual(original_cache, merger._cached_trees)
 
1257
 
1235
1258
    def test_find_base(self):
1236
1259
        merger = self.make_Merger(self.setup_simple_graph(), 'C-id')
1237
1260
        self.assertEqual('A-id', merger.base_rev_id)