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