~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
from bzrlib.errors import UnrelatedBranches, NoCommits, BzrCommandError
33
33
from bzrlib.merge import transform_tree, merge_inner, _PlanMerge
34
34
from bzrlib.osutils import pathjoin, file_kind
 
35
from bzrlib.revision import common_ancestor
35
36
from bzrlib.tests import TestCaseWithTransport, TestCaseWithMemoryTransport
36
37
from bzrlib.trace import (enable_test_log, disable_test_log)
37
38
from bzrlib.workingtree import WorkingTree
105
106
        """Merge base is sane when two unrelated branches are merged"""
106
107
        wt1, br2 = self.test_pending_with_null()
107
108
        wt1.commit("blah")
108
 
        wt1.lock_read()
109
 
        try:
110
 
            last = wt1.branch.last_revision()
111
 
            last2 = br2.last_revision()
112
 
            graph = wt1.branch.repository.get_graph()
113
 
            self.assertEqual(last2, graph.find_unique_lca(last, last2))
114
 
        finally:
115
 
            wt1.unlock()
 
109
        last = wt1.branch.last_revision()
 
110
        self.assertEqual(common_ancestor(last, last, wt1.branch.repository), last)
116
111
 
117
112
    def test_create_rename(self):
118
113
        """Rename an inventory entry while creating the file"""
450
445
        finally:
451
446
            tree_file.close()
452
447
 
453
 
    def test_merge_add_into_deleted_root(self):
454
 
        # Yes, people actually do this.  And report bugs if it breaks.
455
 
        source = self.make_branch_and_tree('source', format='rich-root-pack')
456
 
        self.build_tree(['source/foo/'])
457
 
        source.add('foo', 'foo-id')
458
 
        source.commit('Add foo')
459
 
        target = source.bzrdir.sprout('target').open_workingtree()
460
 
        subtree = target.extract('foo-id')
461
 
        subtree.commit('Delete root')
462
 
        self.build_tree(['source/bar'])
463
 
        source.add('bar', 'bar-id')
464
 
        source.commit('Add bar')
465
 
        subtree.merge_from_branch(source.branch)
466
 
 
467
448
 
468
449
class TestPlanMerge(TestCaseWithMemoryTransport):
469
450
 
470
451
    def setUp(self):
471
452
        TestCaseWithMemoryTransport.setUp(self)
472
 
        self.vf = knit.make_file_knit('root', self.get_transport(),
473
 
            create=True)
 
453
        self.vf = knit.KnitVersionedFile('root', self.get_transport(),
 
454
                                         create=True)
474
455
        self.plan_merge_vf = versionedfile._PlanMergeVersionedFile('root',
475
456
                                                                   [self.vf])
476
457