1
# Copyright (C) 2007-2012 Canonical Ltd
1
# Copyright (C) 2007, 2009 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
242
242
branch_2 = tree_2.branch
243
243
# now reconfigure to be stacked
244
244
out, err = self.run_bzr('reconfigure --stacked-on b1 b2')
245
self.assertContainsRe(out, '^.*/b2/ is now stacked on ../b1\n$')
245
self.assertContainsRe(out,
246
'^.*/b2/ is now stacked on ../b1\n$')
246
247
self.assertEquals('', err)
247
248
# can also give the absolute URL of the branch, and it gets stored
248
249
# as a relative path if possible
249
250
out, err = self.run_bzr('reconfigure --stacked-on %s b2'
250
% (self.get_url('b1'),))
251
self.assertContainsRe(out, '^.*/b2/ is now stacked on ../b1\n$')
251
% (self.get_url('b1'),))
252
self.assertContainsRe(out,
253
'^.*/b2/ is now stacked on ../b1\n$')
252
254
self.assertEquals('', err)
253
# Refresh the branch as 'reconfigure' modified it
254
branch_2 = branch_2.bzrdir.open_branch()
255
255
# It should be given a relative URL to the destination, if possible,
256
256
# because that's most likely to work across different transports
257
self.assertEquals('../b1', branch_2.get_stacked_on_url())
257
self.assertEquals(branch_2.get_stacked_on_url(),
258
259
# commit, and it should be stored into b2's repo
259
260
self.build_tree_contents([('foo', 'new foo')])
260
261
tree_2.commit('update foo')
263
264
self.assertContainsRe(out,
264
265
'^.*/b2/ is now not stacked\n$')
265
266
self.assertEquals('', err)
266
# Refresh the branch as 'reconfigure' modified it
267
branch_2 = branch_2.bzrdir.open_branch()
268
self.assertRaises(errors.NotStacked, branch_2.get_stacked_on_url)
267
self.assertRaises(errors.NotStacked,
268
branch_2.get_stacked_on_url)
270
270
# XXX: Needs a test for reconfiguring stacking and shape at the same time;
271
271
# no branch at location; stacked-on is not a branch; quiet mode.