296
296
out, err = self.run_bzr(['push', '--reference', trunk_tree.branch.base,
297
297
self.get_url('published')], working_dir='branch')
298
298
self.assertEqual('', out)
299
self.assertEqual('Created new shallow branch referring to %s.\n' %
299
self.assertEqual('Created new stacked branch referring to %s.\n' %
300
300
trunk_tree.branch.base, err)
301
301
self.assertPublished(branch_tree.last_revision(),
302
302
trunk_tree.branch.base)
304
def test_push_new_branch_shallow_uses_parent_when_no_public_url(self):
304
def test_push_new_branch_stacked_uses_parent_when_no_public_url(self):
305
305
"""When the parent has no public url the parent is used as-is."""
306
306
trunk_tree, branch_tree = self.create_trunk_and_feature_branch()
307
# now we do a shallow push, which should determine the public location
307
# now we do a stacked push, which should determine the public location
309
out, err = self.run_bzr(['push', '--shallow',
309
out, err = self.run_bzr(['push', '--stacked',
310
310
self.get_url('published')], working_dir='branch')
311
311
self.assertEqual('', out)
312
self.assertEqual('Created new shallow branch referring to %s.\n' %
312
self.assertEqual('Created new stacked branch referring to %s.\n' %
313
313
trunk_tree.branch.base, err)
314
314
self.assertPublished(branch_tree.last_revision(), trunk_tree.branch.base)
316
def test_push_new_branch_shallow_uses_parent_public(self):
317
"""Pushing a new branch with --shallow creates a stacked branch."""
316
def test_push_new_branch_stacked_uses_parent_public(self):
317
"""Pushing a new branch with --stacked creates a stacked branch."""
318
318
trunk_tree, branch_tree = self.create_trunk_and_feature_branch()
319
319
# the trunk is published on a web server
320
320
self.transport_readonly_server = HttpServer
322
322
trunk_public.pull(trunk_tree.branch)
323
323
trunk_public_url = self.get_readonly_url('public_trunk')
324
324
trunk_tree.branch.set_public_branch(trunk_public_url)
325
# now we do a shallow push, which should determine the public location
325
# now we do a stacked push, which should determine the public location
327
out, err = self.run_bzr(['push', '--shallow',
327
out, err = self.run_bzr(['push', '--stacked',
328
328
self.get_url('published')], working_dir='branch')
329
329
self.assertEqual('', out)
330
self.assertEqual('Created new shallow branch referring to %s.\n' %
330
self.assertEqual('Created new stacked branch referring to %s.\n' %
331
331
trunk_public_url, err)
332
332
self.assertPublished(branch_tree.last_revision(), trunk_public_url)
334
def test_push_new_branch_shallow_no_parent(self):
335
"""Pushing with --shallow and no parent branch errors."""
334
def test_push_new_branch_stacked_no_parent(self):
335
"""Pushing with --stacked and no parent branch errors."""
336
336
branch = self.make_branch_and_tree('branch', format='development')
337
# now we do a shallow push, which should fail as the place to refer too
337
# now we do a stacked push, which should fail as the place to refer too
338
338
# cannot be determined.
339
339
out, err = self.run_bzr_error(
340
['Could not determine branch to refer to\\.'], ['push', '--shallow',
340
['Could not determine branch to refer to\\.'], ['push', '--stacked',
341
341
self.get_url('published')], working_dir='branch')
342
342
self.assertEqual('', out)
343
343
self.assertFalse(self.get_transport('published').has('.'))