~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_pull.py

Merged bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import os
20
20
 
21
21
from bzrlib.branch import Branch
22
 
from bzrlib.osutils import abspath, realpath
 
22
from bzrlib import errors
23
23
from bzrlib.tests import TestCaseWithTransport
24
24
 
25
25
 
53
53
        parent.commit('merge other', rev_id='P2')
54
54
        mine.pull(parent.branch)
55
55
        self.assertEqual(['P1', 'P2'], mine.branch.revision_history())
 
56
 
 
57
    def test_pull_updates_checkout_and_master(self):
 
58
        """Pulling into a checkout updates the checkout and the master branch"""
 
59
        master_tree = self.make_branch_and_tree('master')
 
60
        rev1 = master_tree.commit('master')
 
61
        checkout = master_tree.branch.create_checkout('checkout')
 
62
 
 
63
        other = master_tree.branch.bzrdir.sprout('other').open_workingtree()
 
64
        rev2 = other.commit('other commit')
 
65
        # now pull, which should update both checkout and master.
 
66
        checkout.branch.pull(other.branch)
 
67
        self.assertEqual([rev1, rev2], checkout.branch.revision_history())
 
68
        self.assertEqual([rev1, rev2], master_tree.branch.revision_history())
 
69
 
 
70
    def test_pull_raises_specific_error_on_master_connection_error(self):
 
71
        master_tree = self.make_branch_and_tree('master')
 
72
        checkout = master_tree.branch.create_checkout('checkout')
 
73
        other = master_tree.branch.bzrdir.sprout('other').open_workingtree()
 
74
        # move the branch out of the way on disk to cause a connection
 
75
        # error.
 
76
        os.rename('master', 'master_gone')
 
77
        # try to pull, which should raise a BoundBranchConnectionFailure.
 
78
        self.assertRaises(errors.BoundBranchConnectionFailure,
 
79
                checkout.branch.pull, other.branch)