+ def test_push_smart_with_default_stacking_1_9_on_2a_bug_393677(self):
+ # If the default stacked-on location is a 2a format repo, and the
+ # branch being pushed has a 1.9 repository the result of pushing
+ # should be a clean error: The user has to upgrade to interoperate
+ # with that project anyway.
+ self.setup_smart_server_with_call_log()
+ self.make_branch('stack-on', format='2a')
+ self.make_bzrdir('.').get_config().set_default_stack_on('stack-on')
+ self.make_branch('from', format='1.9')
+ out, err = self.run_bzr_error([],
+ ['push', '-d', 'from', self.get_url('to')])
+ self.assertRaises(errors.NotBranchError, bzrdir.BzrDir.open,
+ self.get_url('to'))
+
def create_simple_tree(self):
tree = self.make_branch_and_tree('tree') self.build_tree(['tree/a'])
+ def test_create_clone_on_transport_autostack_incompatible(self):
+ # Test that when we push somewhere with an autostack policy pointing
+ # at an incompatible branch we give an error cleanly and don't create
+ # the target.
+ tree = self.make_branch_and_tree('source')
+ revid = tree.commit('a commit')
+ # Create an incompatible format - rich roots we try to stack on
+ # 1.9, and non rich roots (like 1.9) we try to stack on 2a.
+ if tree.branch.repository.supports_rich_root():
+ trunk_format = "1.9"
+ else:
+ trunk_format = "2a"
+ target_transport = self.get_transport('target')
+ trunk = self.make_branch_and_tree(target_transport.base,
+ format=trunk_format)
+ source = tree.branch
+ self.assertRaises(errors.IncompatibleRepositories,
+ source.create_clone_on_transport, target_transport,
+ stacked_on=trunk.base)
+ self.assertRaises(errors.NotBranchError,
+ bzrdir.BzrDir.open_from_transport, target_transport)
+
def test_create_clone_on_transport_missing_parent_dir(self):
tree = self.make_branch_and_tree('source') tree.commit('a commit')
=== modified file 'bzrlib/ tests/blackbox/ test_push. py' tests/blackbox/ test_push. py 2009-08-20 04:09:58 +0000 tests/blackbox/ test_push. py 2009-08-27 00:21:06 +0000 Branch. open(self. get_url( 'to'))
self. assertEqual( '../stack- on', b.get_stacked_ on_url( ))
--- bzrlib/
+++ bzrlib/
@@ -278,6 +278,20 @@
b = branch.
+ def test_push_ smart_with_ default_ stacking_ 1_9_on_ 2a_bug_ 393677( self): smart_server_ with_call_ log() branch( 'stack- on', format='2a') bzrdir( '.').get_ config( ).set_default_ stack_on( 'stack- on') branch( 'from', format='1.9') bzr_error( [], url('to' )]) es(errors. NotBranchError, bzrdir.BzrDir.open, simple_ tree(self) : branch_ and_tree( 'tree')
self. build_tree( ['tree/ a'])
+ # If the default stacked-on location is a 2a format repo, and the
+ # branch being pushed has a 1.9 repository the result of pushing
+ # should be a clean error: The user has to upgrade to interoperate
+ # with that project anyway.
+ self.setup_
+ self.make_
+ self.make_
+ self.make_
+ out, err = self.run_
+ ['push', '-d', 'from', self.get_
+ self.assertRais
+ self.get_url('to'))
+
def create_
tree = self.make_
=== modified file 'bzrlib/ tests/per_ branch/ test_create_ clone.py' tests/per_ branch/ test_create_ clone.py 2009-08-20 04:09:58 +0000 tests/per_ branch/ test_create_ clone.py 2009-08-27 00:21:06 +0000
--- bzrlib/
+++ bzrlib/
@@ -16,15 +16,40 @@
"""Tests for branch.create_clone behaviour."""
+from bzrlib import ( tests.per_ branch. test_branch import TestCaseWithBranch
+ bzrdir,
+ errors,
+ remote,
+ tests,
+ )
from bzrlib.branch import Branch
-from bzrlib import errors
-from bzrlib import remote
-from bzrlib import tests
from bzrlib.
class TestCreateClone (TestCaseWithBr anch):
+ def test_create_ clone_on_ transport_ autostack_ incompatible( self): branch_ and_tree( 'source' ) repository. supports_ rich_root( ): transport( 'target' ) branch_ and_tree( target_ transport. base, trunk_format) es(errors. IncompatibleRep ositories, create_ clone_on_ transport, target_transport, on=trunk. base) es(errors. NotBranchError, BzrDir. open_from_ transport, target_transport) clone_on_ transport_ missing_ parent_ dir(self) : branch_ and_tree( 'source' )
tree. commit( 'a commit')
+ # Test that when we push somewhere with an autostack policy pointing
+ # at an incompatible branch we give an error cleanly and don't create
+ # the target.
+ tree = self.make_
+ revid = tree.commit('a commit')
+ # Create an incompatible format - rich roots we try to stack on
+ # 1.9, and non rich roots (like 1.9) we try to stack on 2a.
+ if tree.branch.
+ trunk_format = "1.9"
+ else:
+ trunk_format = "2a"
+ target_transport = self.get_
+ trunk = self.make_
+ format=
+ source = tree.branch
+ self.assertRais
+ source.
+ stacked_
+ self.assertRais
+ bzrdir.
+
def test_create_
tree = self.make_