249
250
tree_a.commit('commit b')
251
252
parent = branch_b.get_parent()
253
branch_b = branch.Branch.open('branch_b')
254
branch_b.lock_write()
252
255
branch_b.set_parent(None)
253
257
self.assertEqual(None, branch_b.get_parent())
254
258
# test pull for failure without parent set
256
out = self.run_bzr('pull', retcode=3)
259
out = self.run_bzr('pull', retcode=3, working_dir='branch_b')
257
260
self.assertEqual(out,
258
261
('','bzr: ERROR: No pull location known or specified.\n'))
259
262
# test implicit --remember when no parent set, this pull conflicts
260
self.build_tree(['d'])
263
self.build_tree(['branch_b/d'])
262
265
tree_b.commit('commit d')
263
out = self.run_bzr('pull ../branch_a', retcode=3)
266
out = self.run_bzr('pull ../branch_a', retcode=3,
267
working_dir='branch_b')
264
268
self.assertEqual(out,
265
269
('','bzr: ERROR: These branches have diverged.'
266
270
' Use the missing command to see how.\n'
267
271
'Use the merge command to reconcile them.\n'))
268
self.assertEqual(branch_b.get_parent(), parent)
272
branch_b = branch.Branch.open('branch_b')
273
self.assertEqual(parent, branch_b.get_parent())
269
274
# test implicit --remember after resolving previous failure
270
uncommit(branch=branch_b, tree=tree_b)
275
uncommit(branch=tree_b.branch, tree=tree_b)
271
276
transport.delete('branch_b/d')
277
self.run_bzr('pull', working_dir='branch_b')
278
branch_b = branch.Branch.open('branch_b')
273
279
self.assertEqual(branch_b.get_parent(), parent)
274
280
# test explicit --remember
275
self.run_bzr('pull ../branch_c --remember')
276
self.assertEqual(branch_b.get_parent(),
277
branch_c.bzrdir.root_transport.base)
281
self.run_bzr('pull ../branch_c --remember', working_dir='branch_b')
282
branch_b = branch.Branch.open('branch_b')
283
self.assertEqual(branch_c.bzrdir.root_transport.base,
284
branch_b.get_parent())
279
286
def test_pull_bundle(self):
280
287
from bzrlib.testament import Testament