1
# Copyright (C) 2007-2012 Canonical Ltd
1
# Copyright (C) 2007-2012, 2016 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
# now reconfigure to be stacked
243
243
out, err = self.run_bzr('reconfigure --stacked-on b1 b2')
244
244
self.assertContainsRe(out, '^.*/b2/ is now stacked on ../b1\n$')
245
self.assertEquals('', err)
245
self.assertEqual('', err)
246
246
# can also give the absolute URL of the branch, and it gets stored
247
247
# as a relative path if possible
248
248
out, err = self.run_bzr('reconfigure --stacked-on %s b2'
249
249
% (self.get_url('b1'),))
250
250
self.assertContainsRe(out, '^.*/b2/ is now stacked on ../b1\n$')
251
self.assertEquals('', err)
251
self.assertEqual('', err)
252
252
# Refresh the branch as 'reconfigure' modified it
253
253
branch_2 = branch_2.bzrdir.open_branch()
254
254
# It should be given a relative URL to the destination, if possible,
255
255
# because that's most likely to work across different transports
256
self.assertEquals('../b1', branch_2.get_stacked_on_url())
256
self.assertEqual('../b1', branch_2.get_stacked_on_url())
257
257
# commit, and it should be stored into b2's repo
258
258
self.build_tree_contents([('foo', 'new foo')])
259
259
tree_2.commit('update foo')
261
261
out, err = self.run_bzr('reconfigure --unstacked b2')
262
262
self.assertContainsRe(out,
263
263
'^.*/b2/ is now not stacked\n$')
264
self.assertEquals('', err)
264
self.assertEqual('', err)
265
265
# Refresh the branch as 'reconfigure' modified it
266
266
branch_2 = branch_2.bzrdir.open_branch()
267
267
self.assertRaises(errors.NotStacked, branch_2.get_stacked_on_url)