1
# Copyright (C) 2007, 2009 Canonical Ltd
1
# Copyright (C) 2007-2012 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,
246
'^.*/b2/ is now stacked on ../b1\n$')
245
self.assertContainsRe(out, '^.*/b2/ is now stacked on ../b1\n$')
247
246
self.assertEquals('', err)
248
247
# can also give the absolute URL of the branch, and it gets stored
249
248
# as a relative path if possible
250
249
out, err = self.run_bzr('reconfigure --stacked-on %s b2'
251
% (self.get_url('b1'),))
252
self.assertContainsRe(out,
253
'^.*/b2/ is now stacked on ../b1\n$')
250
% (self.get_url('b1'),))
251
self.assertContainsRe(out, '^.*/b2/ is now stacked on ../b1\n$')
254
252
self.assertEquals('', err)
253
b2 = bzrdir.BzrDir.open('b2').open_branch()
255
254
# It should be given a relative URL to the destination, if possible,
256
255
# because that's most likely to work across different transports
257
self.assertEquals(branch_2.get_stacked_on_url(),
256
self.assertEquals('../b1', b2.get_stacked_on_url())
259
257
# commit, and it should be stored into b2's repo
260
258
self.build_tree_contents([('foo', 'new foo')])
261
259
tree_2.commit('update foo')
264
262
self.assertContainsRe(out,
265
263
'^.*/b2/ is now not stacked\n$')
266
264
self.assertEquals('', err)
267
self.assertRaises(errors.NotStacked,
268
branch_2.get_stacked_on_url)
265
b2 = bzrdir.BzrDir.open('b2').open_branch()
266
self.assertRaises(errors.NotStacked, b2.get_stacked_on_url)
270
268
# XXX: Needs a test for reconfiguring stacking and shape at the same time;
271
269
# no branch at location; stacked-on is not a branch; quiet mode.