~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_merge.py

  • Committer: Jelmer Vernooij
  • Date: 2012-04-16 11:08:11 UTC
  • mfrom: (6521 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6522.
  • Revision ID: jelmer@samba.org-20120416110811-0y996ihqy9o2bb1t
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
from bzrlib import (
28
28
    branch,
29
 
    bzrdir,
30
29
    conflicts,
 
30
    controldir,
31
31
    merge_directive,
32
32
    osutils,
33
33
    tests,
75
75
        return tree, other
76
76
 
77
77
    def test_merge_reprocess(self):
78
 
        d = bzrdir.BzrDir.create_standalone_workingtree('.')
 
78
        d = controldir.ControlDir.create_standalone_workingtree('.')
79
79
        d.commit('h')
80
80
        self.run_bzr('merge . --reprocess --merge-type weave')
81
81
 
278
278
 
279
279
        base = urlutils.local_path_from_url(branch_a.base)
280
280
        self.assertEndsWith(err, '+N  b\nAll changes applied successfully.\n')
 
281
        # re-open branch as external run_bzr modified it
 
282
        branch_b = branch_b.bzrdir.open_branch()
281
283
        self.assertEquals(osutils.abspath(branch_b.get_submit_branch()),
282
284
                          osutils.abspath(parent))
283
285
        # test implicit --remember when committing new file
295
297
                                working_dir='branch_b')
296
298
        self.assertEquals(out, '')
297
299
        self.assertEquals(err, '+N  c\nAll changes applied successfully.\n')
 
300
        # re-open branch as external run_bzr modified it
 
301
        branch_b = branch_b.bzrdir.open_branch()
298
302
        self.assertEquals(osutils.abspath(branch_b.get_submit_branch()),
299
303
                          osutils.abspath(branch_c.bzrdir.root_transport.base))
300
304
        # re-open tree as external run_bzr modified it
553
557
        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
554
558
        tree_c = tree_a.bzrdir.sprout('c').open_workingtree()
555
559
        out, err = self.run_bzr(['merge', '-d', 'c'])
556
 
        self.assertContainsRe(err, 'Merging from remembered parent location .*a\/')
557
 
        tree_c.branch.set_submit_branch(tree_b.bzrdir.root_transport.base)
 
560
        self.assertContainsRe(err,
 
561
                              'Merging from remembered parent location .*a\/')
 
562
        tree_c.branch.lock_write()
 
563
        try:
 
564
            tree_c.branch.set_submit_branch(tree_b.bzrdir.root_transport.base)
 
565
        finally:
 
566
            tree_c.branch.unlock()
558
567
        out, err = self.run_bzr(['merge', '-d', 'c'])
559
 
        self.assertContainsRe(err, 'Merging from remembered submit location .*b\/')
 
568
        self.assertContainsRe(err,
 
569
                              'Merging from remembered submit location .*b\/')
560
570
 
561
571
    def test_remember_sets_submit(self):
562
572
        tree_a = self.make_branch_and_tree('a')
566
576
 
567
577
        # Remember should not happen if using default from parent
568
578
        out, err = self.run_bzr(['merge', '-d', 'b'])
569
 
        self.assertIs(tree_b.branch.get_submit_branch(), None)
 
579
        refreshed = workingtree.WorkingTree.open('b')
 
580
        self.assertIs(refreshed.branch.get_submit_branch(), None)
570
581
 
571
582
        # Remember should happen if user supplies location
572
583
        out, err = self.run_bzr(['merge', '-d', 'b', 'a'])
573
 
        self.assertEqual(tree_b.branch.get_submit_branch(),
 
584
        refreshed = workingtree.WorkingTree.open('b')
 
585
        self.assertEqual(refreshed.branch.get_submit_branch(),
574
586
                         tree_a.bzrdir.root_transport.base)
575
587
 
576
588
    def test_no_remember_dont_set_submit(self):